AWK: Pattern Matching and Processing
awk 'pattern {action}' filename Reads one line at a time from file, checks for pattern match, performs action if pattern matched pattern. NR is a special awk variable meaning the line number of the current record can use a line number, to select a specific line, by comparing it to NR (for example: NR == 2) can specify a range of line numbers (for example: NR == 2, NR == 4) can specify a regular expression, to select all lines that match $n are special awk variables, meaning the value of the nth field (field delimiter is space or tab) $0 is the entire record can use field values, by comparing to $n (for example: $3 == 65) every line is selected if no pattern is specified Instructions print - print line(s) that match the pattern, or print fields within matching lines print is default if no action is specified there are many, many instruction, including just about all C statements with similar syntax other instructions will be covered in future courses examples, using the fi