Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #example File1
- bob smith 100
- tim zim 123
- ted fred 450
- bob hill 543
- #get the sum of column 3
- awk '{total += $1} END {print total}' File1
- #example File2
- bob smith $100
- tim zim $123
- ted fred $450
- bob hill $543
- #remove the '$' and then get sum of column 3
- awk '{gsub(/\$/,"");total += $3} END {print total}' File2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement