awk built-in variables
Variables awk sets for every line: NR counts records read, NF counts fields, FS splits input and OFS joins output.
In more detail
awk 'NR > 1' skips a header line, and setting OFS=, makes print separate fields with commas. They save cutting columns with a second command.
Related terms
- awk — A small programming language for text that splits each line into fields and runs actions on the lines that match a condition.
Taught in
- The Pager Goes Off At 2 A.M.: A Three-Question Triage — CompTIA Linux+ (XK0-006) Exam Prep
- The Cleanup That Emptied The Wrong Directory: Shell Scripts Under Exam Conditions — CompTIA Linux+ (XK0-006) Exam Prep