Text ProcessingLesson 18Free preview
Bash Pattern Scan (awk)
This lesson is part of Bash · All levels
Summary
The awk command processes line-by-line text based on the spaced columns inherently. You name the column with $1, $2, etc., and add the BEGIN/END conditions and blocks for the start and end actions. Awk is very flexible for simple reporting, filtering, and data recapitulation.
Key points
- First column $1, last column $NF
- F changed the column divider
- BLOCK BEGIN of the road before the first line, END after the last line
- The line is a condition, empty means all lines
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.