Wednesday, August 31, 2011

Awk one liner IF

Here is a quick one liner AWK for field comparison.

awk -F, '{if ($(1)=="0") {print $1}}' myfilename
What does it do?
From the comma separated file every record with first field as zero is printed.

It's important to keep parentheses as indicated. Although "print $1" is good; "if $1" poops.

No comments:

Post a Comment