February 2004
Beginner
200 pages
5h 40m
English
awk is a pattern-matching language. It can match data by regular expression, and perform actions based on the data. Here are a few simple examples for processing a text file, myfile.
Print the second and fourth word on each line:
$ awk '{print $2, $4}' myfilePrint all lines that are shorter than 60 characters:
$ awk '{length($0) < 60}' myfile