[PLUG] awk: is field blank?

Tomas Kuchta tomas.kuchta.lists at gmail.com
Sun Oct 31 02:53:32 UTC 2021


Awk variable NF contains number of fieds. So:
awk 'NF==8 { print }'

Will print lines with 8 fields.

Best, Tomas


On Sat, Oct 30, 2021, 11:31 Rich Shepard <rshepard at appl-ecosys.com> wrote:

> I've a 351K line file with 8 fields. About 50K of those lines has $8 blank.
> I want awk to print only rows with values in all 8 fields. I'm not finding
> how to tell awk to print $0 if $8 is not blank.
>
> My awk/sed book doesn't seem to have this information and my web searches
> aren't finding the answer, either.
>
> Clue needed.
>
> Rich
>



More information about the PLUG mailing list