[PLUG] awk: is field blank?

Rich Shepard rshepard at appl-ecosys.com
Sat Oct 30 15:51:08 UTC 2021


On Sat, 30 Oct 2021, Robert Citek wrote:

> Here's a sample:
> $ echo -e "a\tb\tc\td\na\tb\t\td" | awk -F'\t' '{print}'
> a b c d
> a b   d

> $ echo -e "a\tb\tc\td\na\tb\t\td" | awk -F'\t' '$3=="" {print}'
> a b   d

My script uses if and awk doesn't like how I've used it:
BEGIN {FS="|";OFS="|"}
if {$8!=""} {
       print $0
    }

gawk -f clean-broadway-file.awk mean-vel-broadway.dat > out.dat
gawk: clean-broadway-file.awk:8: if {$8==""} {
gawk: clean-broadway-file.awk:8: ^ syntax error

I want to print the whole line only if $8 is not empty.

Thanks,

Rich



More information about the PLUG mailing list