awk Question

Dennis O'Neill oneill at getafix.slcs.slb.com
Tue Jan 9 02:53:49 AEST 1990


I'm trying to use awk to convert a LaTeX file of mailing address to something
more acceptable to Oracle's bulk data loading facility. Each entry in the file
is a macro for a particular location in the form of

\def\slny{Schlumberger Limited\\
277 Park Avenue\\
New York, NY  10172-0266}

Successive addresses are separated by blank lines; so I'm trying something like

BEGIN{
        FS = "\\"
        RS = ""
        ORS = "\n\n"
        }
$2 ~ /def/ {gsub(/\\\\/, ""); print $3 $4 $5 $6 $7 $8 $9 $10}

And I get 

awk: syntax error near line 8
awk: illegal statement near line 8

It seems it doesn't like the gsub call. So I tried a test with just

{gsub(/\\\\/, "");  print $0}

and get essentially the same message:

awk: syntax error near line 1
awk: illegal statement near line 1

In fact, regardless of what I use for the first argument to gsub, I get the same
error. What am I doing wrong?

Thanks in advance,

Dennis O'Neill



More information about the Comp.unix.questions mailing list