[PLUG] awk syntax

Marvin Kosmal mkosmal at gmail.com
Thu May 24 18:20:28 UTC 2012


HI

I don't think it like the space before  |

Should be FS="|";

Best

Marvin

On Thu, May 24, 2012 at 11:04 AM, Rich Shepard <rshepard at appl-ecosys.com> wrote:
>   I'm re-reading the ORA 'sed & awk' 2nd edition because I need to modify
> data files (>130K lines in one and >45K lines in another). Should be a
> simple script but I'm getting a syntax error trying to define the OFS.
>
>   Here's a line of the data file:
> 'D-1'|'2007-12-12'|'Ag'|0.000|
>
>   Since fields in the data file are delineated with '|'. I define FS = '|'
> in the BEGIN section, but awk doesn't like me to also define OFS there:
>
> awk: ./add-non-detect.awk:7: BEGIN { FS = "|" OFS = "|" }
> awk: ./add-non-detect.awk:7:                      ^ syntax error
>
>   There's no explicit example in the book, only statements that the default
> output field separator is a space, and that's applied by putting a comma
> after the field variable. What have I missed?
>
> Rich
>
>
>
>
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug



More information about the PLUG mailing list