ファイル操作のための汎用プログラミング言語。 もっと詳しく: https://github.com/onetrueawk/awk。
awk '{print $5}' {{path/to/file}}
awk '/{{foo}}/ {print $2}' {{path/to/file}}
awk -F ',' '{print $NF}' {{path/to/file}}
awk '{s+=$1} END {print s}' {{path/to/file}}
awk 'NR%3==1' {{path/to/file}}
awk '{if ($1 == "foo") print "Exact match foo"; else if ($1 ~ "bar") print "Partial match bar"; else print "Baz"}' {{path/to/file}}
awk '($10 >= {{min_value}} && $10 <= {{max_value}})'
%-20s
は左寄せ文字列20文字を意味する。%6s
は右寄せ文字列6文字を意味する。):awk 'BEGIN {FS=":";printf "%-20s %6s %25s\n", "Name", "UID", "Shell"} $4 >= 1000 {printf "%-20s %6d %25s\n", $1, $4, $7}' /etc/passwd