I've written a one-liner and it is producing the results I want, but I'm not confident that it is written correctly.
I'm trying to print the first field of each record and omit the last line of a file.
Then I realized that $NF represents the Number of Fields in the current record. So I'm not sure how this is working correctly since the last line has more the 0 fields.
Is there a better way to write/accomplish this?
Thanks,
I'm trying to print the first field of each record and omit the last line of a file.
Code:
cat clients | awk '{a=0; if (a > $NF) print $1}'
Then I realized that $NF represents the Number of Fields in the current record. So I'm not sure how this is working correctly since the last line has more the 0 fields.
Is there a better way to write/accomplish this?
Thanks,