awk One-Liners
(This is a work in progress)
Get the average of a column
ls -l | grep -v total | awk -F' ' '{sum += $5 } END { print "AVG=", sum/NR }'
Print a file with line numbers
awk '{ print FNR "\t" $0 }' file
Print number of lines in a file (analogous to wc -l
)
awk 'END { print NR }'
Comments
Post a Comment