ARCHIVED: What is awk, and how do I use it?
At Indiana University, you can use awk
on all the Unix-based central systems. Although awk
is a complete pattern scanning and processing language, it is most commonly used as a Unix command-line filter to reformat the output of other commands. For example, to print only the second and sixth fields of the date
command (the month and year) with a space separating them, at the Unix prompt, you would enter:
date | awk '{print $2 " " $6}'
To read the online manual (the man page) for awk
, at the Unix prompt, enter:
man awk
Also, consult the newsgroup comp.lang.awk
.
gawk
is a version of awk
produced by the GNU Project. At IU, it is available on Quarry in the /usr/bin/gawk
directory, and on the Research
Database Complex (RDC) in the /opt/freeware/bin/gawk
directory.
For information about gawk
, at the Unix prompt, enter:
man gawk
At Indiana University, for personal or departmental Linux or Unix systems support, see Get help for Linux or Unix at IU.
This is document afja in the Knowledge Base.
Last modified on 2018-01-18 10:00:50.