Skip to content

Instantly share code, notes, and snippets.

@soardex
Created January 22, 2016 11:05
Show Gist options
  • Save soardex/cf30a8d0673ba1e9f4d3 to your computer and use it in GitHub Desktop.
Save soardex/cf30a8d0673ba1e9f4d3 to your computer and use it in GitHub Desktop.
Awk Internal Variables
FILENAME: References the current input file.
FNR: References the number of the current record relative to the current input file. For instance, if you have two input files, this would tell you the record number of each file instead of as a total.
FS: The current field separator used to denote each field in a record. By default, this is set to whitespace.
NF: The number of fields in the current record.
NR: The number of the current record.
OFS: The field separator for the outputted data. By default, this is set to whitespace.
ORS: The record separator for the outputted data. By default, this is a newline character.
RS: The record separator used to distinguish separate records in the input file. By default, this is a newline character.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment