Monday 29 December 2008

sum of 2nd column of 4 files

suppose i have 4 files like ip1,ip2,ip3,ip4. I want to sum all the second column values of all the four files with each file containing dot seperated content like 172.22.21.21 etc..How to do using awk in one line?

awk -F"." '{sum+=$2} END {print sum}' ip*

No comments:

Post a Comment

Tweets by @sriramperumalla