![]() |
My Top 3 |
![]() |
If you have a file with multiple columns
1 5
5 7
2 7
9 2
and you want to add up a specific column, the following command can be used:
$ awk -v col=2 ‘{ total += $col } END { print total }’ FILENAME
Where “col=2″ is the second column in the file.
Related posts
- Linux Tip of the Day - Yet another countdown (0)
- Linux Tip of the Day - Why mv is slow (0)
- Linux Tip of the Day - What file is that in (0)
- Linux Tip of the Day - Watching make (0)



Leave a Reply