Hi @ all
I'm trying to achive to this problem,
I've a 2-column composed file as the following:
192.168.1.2 2
192.168.1.3 12
192.168.1.2 4
192.168.1.4 3
cpc1-swan1-2-3-cust123.swan.cable.ntl.com 4
192.168.1.3 5
192.168.1.2 10
192.168.1.4 8
cpc1-swan1-2-3-cust123.swan.cable.ntl.com 8
and i would this kind of output :
192.168.1.2 10
192.168.1.3 12
192.168.1.4 8
cpc1-swan1-2-3-cust123.swan.cable.ntl.com 8
I'm trying to use this methodology :
Code:
awk '{ a[$NF]=$2; if ( a[$NF] >= max[$NF] ) max[$NF]=a[$NF] } END { for ( item in a ) print item,max[item] }'
but i'm not sure this is the right way....
Thanks you all in advance!!!
m4rco-