[PLUG] AWK script syntax error

Daniel Hedlund daniel at digitree.org
Thu Mar 3 22:11:53 UTC 2011


On Thu, Mar 3, 2011 at 13:59, wes <plug at the-wes.com> wrote:
> I don't know much about awk, so I won't be able to answer your question.
>
> However, to simply remove whole lines, I would use grep:
>
> grep -v '|0.000000|' [filename]

Rich's awk script only checks the second column for 0.000...  The
following might be more accurate if that was his intended behavior.
grep -v '^[^|]*|0\.000000|' [filename]

...if he wants to continue using awk, I believe the following will
work (the "print NR" was removed):

BEGIN { FS="|" }
  {if ($2 != 0.000000)
    print $1"|"$2"|"$3}
END {}


Cheers,

Daniel Hedlund
daniel at digitree.org



More information about the PLUG mailing list