I have no idea what you are trying to accomplish with the statement 3 tempMax=$2.
You can't have an array and a scalar variable with the same name: retransmissions[$1]=retransmissions.
If you have multiple statements to be processed in a loop, in an if, or in an else, you need to use braces ({ and }) to group those statements.
The expression ($3 in c) is meaningless when you haven't created any elements in an array named c[].
You don't calculate an average of n items by subtracting the lowest value from the highest value.
Using sort -u deletes duplicate entries. Deleting duplicate entries makes it impossible to calculate an average of all values for any given IP address, or for an IP address and sequence # pair.
A for(i in c) loop produces output in random (not necessarily sorted) order.
You didn't show what output you hope to produce from your sample input.
You talked about reporting the number of bytes transmitted, but there is nothing in your code that seems to try to capture or print that data. (And, the following script doesn't either.)
You seem to be trying to print the average time as a decimal number and the number of retransmissions as a floating point value printed with one decimal place. (Neither of these make any sense to me.)
So, making lots of wild guesses (ignoring the output your script seemed to be trying to produce), the following might help as a starting point for a script that will do what you want:
which, with the sample input you provided, produces the output:
This User Gave Thanks to Don Cragun For This Post:
Could someone tell me how to perform calculations using numbers greater than 2150000000 in Korn Shell? When I tried to do it it gave me the wrong answer.
e.g. I have a ksh file with the contents below:
---------------------------------
#!/bin/ksh
SUM=`expr 2150000000 + 2`
PRODUCT=`expr... (3 Replies)
I have a large CSV files (e.g. 2 million records) and am hoping to do one of two things. I have been trying to use awk and sed but am a newbie and can't figure out how to get it to work. Any help you could offer would be greatly appreciated - I'm stuck trying to remove the colon and wildcards in... (6 Replies)
Hi
My input file looks like
field1 field2 field3 field4 field5
field1 field2 field3 field4 field5
field1 field2 field3 field4 field5
::::::::::::
::::::::::::
There may be one space of multiple spaces between fields and no fields contains spaces in them.
If field 1 to 4 are equal for... (3 Replies)
I am trying to enter a third column in this file, but the third column should that I call "Math" perform a some math calculations based on the value found in column #2.
Here is the input file:
Here is the desired output:
Output
GERk0203078$ Levir Math
Cotete_1... (5 Replies)
Dear All,
I indeed your help for managing resarch data file.
for example I have,
data1.txt :
type of atoms z vz
Si 34 54
O 20 56
H 14 13
Si 40 17
O ... (11 Replies)
Hi all!
I have a data set in this tab separated format : Label, Value1, Value2
An instance is "data.txt" :
0 1 1
-1 2 3
0 2 2
I would like to parse this data set and generate two files, one that has only data with the label 0 and the other with label -1, so my outputs should be, for... (1 Reply)
Need your help in solving this puzzle. Any kind of help will be appreciated and link for any documents to read and learn and to deal with such scenarios would be helpful
Concatenate column1 and column2 of file 1. Then check for the concatenated value in Column1 of File2. If found extract the... (14 Replies)
Please help me to get required output for both scenario 1 and scenario 2 and need separate code for both scenario 1 and scenario 2
Scenario 1
i need to do below changes only when column1 is CR and column3 has duplicates rows/values. This inputfile can contain 100 of this duplicated rows of... (1 Reply)
Hi Folks,
I'm trying tog ain further experience with shell programming and have set my a small goal of writing a little filesystem monitoring script. So far my output is as follows:
PACMYDB03
Filesystem Size Used Avail Use% Status
/usr/local/mysql/data ... (5 Replies)