awk - pattern scanning and processing language
The AWK command is used to read and print formatted text such as tables
seperated by whitespace.
Usage: awk [POSIX or GNU style options] -f progfile [--] file ...
awk [POSIX or GNU style options] [--] 'program' file ...
POSIX options: GNU long options:
-f progfile --file=progfile
-F fs --field-separator=fs
-v var=val --assign=var=val
-m[fr] val
-W compat --compat
-W copyleft --copyleft
-W copyright --copyright
-W help --help
-W lint --lint
-W lint-old --lint-old
-W posix --posix
-W re-interval --re-interval
-W source=program-text --source=program-text
-W traditional --traditiona
Example:
ls -al | awk '{print $5}'
ls -al | awk '{sum = sum + $5} END {print sum}'
/sbin/ifconfig ppp0|awk '/inet addr/ {gsub(".*:","",$2); print $2}'