Hello,
I have the following input file:
From To len
===== ========== ===
===== ========== ===
210.255.0.1 10.0.0.101 70
210.255.0.2 10.0.0.103 71
210.255.0.1 10.0.0.101 100
210.255.0.2 10.0.0.105 72
210.255.0.1 10.0.0.115 73
210.255.0.1 10.0.0.115 74
210.255.0.3 10.0.0.105 75
210.255.0.2 10.0.0.112 76
210.255.0.1 10.0.0.111 77
210.255.0.3 10.0.0.105 2000
210.255.0.2 10.0.0.105 305
I need the following output
Source Destination No'' of Bytes
------ ----------- -------------
210.255.0.1 10.0.0.101 170
210.255.0.2 10.0.0.103 71
210.255.0.2 10.0.0.105 377
210.255.0.1 10.0.0.115 147
210.255.0.1 10.0.0.111 77
210.255.0.2 10.0.0.112 76
210.255.0.3 10.0.0.105 2075
Where the No'' of Bytes is the sum from each source/destination unique combination.
I am trying the following code but the output concatenatee the source and destination as this (210.255.0.110.0.0.101)
{
arr[$5,$6] +=$12
}
END {
for ( i in arr )
printf(" %s ---------- %s = %d\n",i,arr);
}
I tried to use the split (i, srcdst, "\034") it was fine but affected the No'' of bytes field.
As a aummary I need the following:
1-Get rid of the first three lines on the input file replace them by
Source Destination No'' of Bytes
------ ----------- -------------
2-Each unique combination of varaibles [$1,$2]
3-Put the accumulated value in the $3 on the No'' of Bytes field.
Thanks in advance,
meels
I have the following input file:
From To len
===== ========== ===
===== ========== ===
210.255.0.1 10.0.0.101 70
210.255.0.2 10.0.0.103 71
210.255.0.1 10.0.0.101 100
210.255.0.2 10.0.0.105 72
210.255.0.1 10.0.0.115 73
210.255.0.1 10.0.0.115 74
210.255.0.3 10.0.0.105 75
210.255.0.2 10.0.0.112 76
210.255.0.1 10.0.0.111 77
210.255.0.3 10.0.0.105 2000
210.255.0.2 10.0.0.105 305
I need the following output
Source Destination No'' of Bytes
------ ----------- -------------
210.255.0.1 10.0.0.101 170
210.255.0.2 10.0.0.103 71
210.255.0.2 10.0.0.105 377
210.255.0.1 10.0.0.115 147
210.255.0.1 10.0.0.111 77
210.255.0.2 10.0.0.112 76
210.255.0.3 10.0.0.105 2075
Where the No'' of Bytes is the sum from each source/destination unique combination.
I am trying the following code but the output concatenatee the source and destination as this (210.255.0.110.0.0.101)
{
arr[$5,$6] +=$12
}
END {
for ( i in arr )
printf(" %s ---------- %s = %d\n",i,arr);
}
I tried to use the split (i, srcdst, "\034") it was fine but affected the No'' of bytes field.
As a aummary I need the following:
1-Get rid of the first three lines on the input file replace them by
Source Destination No'' of Bytes
------ ----------- -------------
2-Each unique combination of varaibles [$1,$2]
3-Put the accumulated value in the $3 on the No'' of Bytes field.
Thanks in advance,
meels