[geeks] Awk-related question

Patrick Giagnocavo patrick at zill.net
Wed Jul 26 10:55:39 CDT 2006


I am using awk (gawk actually) for a project.

I am happily reading in fields, however, there are some fields that are
empty, and I don't want to insert formatting around them in that case.

Can anyone tell me why this awk snippet does not work?  $4 is the field
I am checking to see if it is blank or not. The " \@LP " stuff is part
of the formatting.

--------
if (length( $4 ) > 0) {
 print " \@LP " $4
}
--------

Thanks in advance for any help or suggestions.  I also tried if ($4)
since the empty string evals to false, but got nowhere with that.

-- P



More information about the geeks mailing list