Why this awk program in csh shell script doesnot work?

Why this awk program in csh shell script doesnot work?

Post by Bruce Barnet » Sat, 02 May 1998 04:00:00




>                }'  input file > outputfile
> it always complains as Unmatched '. Can any guru tell me why? Thanks.

It works on my system, (once I changed 'input file' to 'input_file'),
but I strongly suggest you use a different shell, or else call the awk
script from the shell using "#!/bin/awk -f". 15 years ago I tried to
manage large AWK scripts in a C shell.  It was the first reason I
found to switch to the Bourne shell.

I also included the optional semicolons, and used cb(1) to indent AWK
scripts, to catch nesting errors.

--
Bruce  <barnett at crd. ge. com> (speaking as myself, and not a GE employee)

 
 
 

Why this awk program in csh shell script doesnot work?

Post by keystr.. » Sat, 02 May 1998 04:00:00



Quote:

> Hi, any unix guru:

> I have following awk program which works fine:

> #!/usr/bin/nawk -f
[SNIP]
> However, when put in csh script as following:

> #!/sbin/csh -f

> awk 'BEGIN { i= 1 }             \
[SNIP]
>                 }'  input file > outputfile

> it always complains as Unmatched '. Can any guru tell me why? Thanks.

Add an extra backslash to each line.
eg:
  awk 'BEGIN { i= 1 } \\

csh dosn't like newlines in quotes.

--
Why is brassiere singular and panties plural?

 
 
 

Why this awk program in csh shell script doesnot work?

Post by Jian-Ping Xion » Tue, 05 May 1998 04:00:00


Hi, Bruce,

Thanks for your response.

That csh script truely works on our university's SUN stations, but
doesnot work on both our own SGI and DEC unix stations. I donot know why.
Anyway, I'll take your suggestion to switch to Bourne shell.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jian-Ping Xiong
Department of Pharmacology and Cancer Biology
Duke University Medical Center
DUMC 3813
Durham, NC 27710
Ph#: 919-681-6415, Fax: 919-684-8922

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



> >                }'  input file > outputfile
> > it always complains as Unmatched '. Can any guru tell me why? Thanks.

> It works on my system, (once I changed 'input file' to 'input_file'),
> but I strongly suggest you use a different shell, or else call the awk
> script from the shell using "#!/bin/awk -f". 15 years ago I tried to
> manage large AWK scripts in a C shell.  It was the first reason I
> found to switch to the Bourne shell.

> I also included the optional semicolons, and used cb(1) to indent AWK
> scripts, to catch nesting errors.

> --
> Bruce  <barnett at crd. ge. com> (speaking as myself, and not a GE employee)