[PLUG] awk syntax error, part ii

Fred James fredjame at fredjame.cnc.net
Fri May 25 18:56:07 UTC 2012


Rich Shepard wrote:
> On Fri, 25 May 2012, Larry Brigman wrote:
>
>   
>> I think your problem lies at the end of each if  or else if statement
>> as you have
>> a semi-colon which terminates the operation.  You can move the semi-colon
>> to inside the } or remove it altogether.
>>     
>
> awk: ./zero-to-rl.awk:17: else if ($3 ~ /Se/ && $4 ~ /0.000/) { print $1,
> $2, $3, "-0.003" }
> awk: ./zero-to-rl.awk:17: ^ syntax error
> awk: ./zero-to-rl.awk:18: else if ($3 ~ /TDS/ && $4 ~ /0.000/) { print $1,
> $2, $3, "-15.000" }
> awk: ./zero-to-rl.awk:18: ^ syntax error
> awk: ./zero-to-rl.awk:19: else { print $1, $2, $3, $4 }
> awk: ./zero-to-rl.awk:19: ^ syntax error
>
>    No semi-colons at the end, same syntax error indication.
>
>    Putting semi-colons inside the closing brace still yields the same syntax
> error indication.
>
> Thanks,
>
> Rich
>   
Should the print be something more like:
   

else { print ($1, $2, $3, $4) }

??
Regards
Fred James





More information about the PLUG mailing list