Hacker News new | ask | show | jobs
by _bAp_ 3626 days ago
Not intuitive enough apparently ;)

$NR stores the number of records (or the current record number) not the number of fields (that's $NF). In the example the "NR > 1" is meant to exclude the header line from the output.

1 comments

You are entirely correct -- I got tunnel vision/brain fart and mixed NF and NR up, newbie mistake!

NR is initialized to 1 on the first line, and is incremented for every subsequent line read. So, in this case, the above pattern will match any line after the first.