Differences
This shows you the differences between two versions of the page.
— | awk [2016/02/17 17:26] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== awk ====== | ||
+ | * [[ack]] | ||
+ | * [[grep]] | ||
+ | * [[sed]] | ||
+ | |||
+ | === Tips and Tricks === | ||
+ | |||
+ | == Use awk to print a specific column == | ||
+ | |||
+ | < | ||
+ | chkconfig --list |grep " | ||
+ | </ | ||
+ | |||
+ | == Print the last column == | ||
+ | |||
+ | < | ||
+ | awk '{ print $NF }' | ||
+ | </ | ||
+ | |||
+ | == Print a total of a column of numbers in a file == | ||
+ | |||
+ | < | ||
+ | awk '{ sum += $1 } END { print sum }' filename | ||
+ | </ |