Awk examples: Difference between revisions

From lippmann wiki
Jump to navigation Jump to search
No edit summary
 
Line 4: Line 4:
  column3 column4
  column3 column4


sum all volumes in a column:
sum all values in a column:


  awk '{ SUM += $1} END {print SUM }'
  awk '{ SUM += $1} END {print SUM }'

Latest revision as of 16:55, 20 June 2015

ignore first columns and print rest

[maarten.tikal] ➤  echo 'column1 column2 column3 column4' | awk '{print substr($0, index($0,$3))}'
column3 column4

sum all values in a column:

awk '{ SUM += $1} END {print SUM }'