NF - Number of Fields in AWK in UNIX

NF is an AWK built-in variable and it returns number of fields in current line

NF is very useful in writing for loops in AWK programming.

Example : Number of Fields in a line
cat file.txt
sam 80
merlin 90
ray 85

awk '{print NF,$0;}' file.txt

2 sam 80
2 merlin 90
1 Alan
2 ray 85