Print all but the first column
awk '{$1="";$0=substr($0,2)}1'
- $1="" - empty the first field
- $0=substr($0,2) - start the whole line at the second position and ignore the space at the first position
- 1 - awk evaluates this as true and the default action is to print the line
Print all but the last column
awk '{$NF=""; NF--; print}'
Find the sum of the 5th column of numbers from stdin
awk '{total+=$5} END {print total}'
Find the average of the 8th column of numbers from stdin
awk '{sum+=$8; ++n} END {print sum/n}'
Print the number of columns
awk '{print NF}'
Calculate 80% of 3rd column
awk '{print $3 * 0.8}'