Thanks radoulov, it works
.
I have another file:
312009 1 0620233743 0620233748 20090620235854 20.7.22.14 aaa
312009 2 0620233743 0620233748 20090620235854 20.7.22.14 aaa
312009 3 0620233743 0620233748 20090620235854 20.7.22.14 aaa
312009 5 0620233743 0620233748 20090620235854 21.7.22.14 aaa
312009 2 0620233743 0620233748 20090620235854 20.7.22.14 aaa
I would like to hav a result of:
20.7.22.1 8
21.7.22.1 5
i did:
perl -F' ' -lane '$h{$F[5]} += $F[1]; END{print "$_: $h{$_}" for sort keys %h}' a.txt
But failed, please advice
Thanks
Instead of
[root@localhost ~]# perl -ane'
print $F[1], "," unless $x{$F[1]}++;
print $/ if eof
' a.txt
if i have a file a.pl, how can i put this command into that file?
Thanks