I have the following file:
cat testing.txt
line1 1
line2 2 2
line3 3 3
line4
I can understand how it works awk 'NF > 0' testing.txt. This command only processes the number of fields with more than 1 field from each record, and thus empty lines and tabs are deleted.
awk 'NF>0' testing.txt
line1 1
line2 2 2
line3 3 3
line4
However, I canβt understand how it works awk NF testing.txt. He does the same as above.
awk NF testing.txt
line1 1
line2 2 2
line3 3 3
line4
I do not indicate any conditions in this case. However, it works fine and removes blank lines and tab from each record.
I see a lot of links on the Internet saying that we can use this command to remove blank lines or tabs from a file. But I can not understand the syntax.
source
share