NF
stands for N
umber of F
ields. So whenever NF
is bigger than 0, that awk
interprets True
. So in fact this is doing:
if NF>0 --> True
if NF==0 --> False
As the default behaviour of awk
is {print $0}
, this means that it does:
if NF>0 ---> True ---> {print $0}
if NF==0 ---> False ---> nothing
So awk NF file
means: print all lines that have at least one field. Which automatically implies: print all no-empty lines.