Re: [SLUG] Awk Question

From: Paul M Foster (paulf@quillandmouse.com)
Date: Tue Nov 06 2001 - 18:21:45 EST


On Tue, Nov 06, 2001 at 09:48:47AM -0500, Robert Haeckl wrote:

> Paul M Foster wrote:
> >
> > This is an obscure one, just for you awk gurus.
> >
> > I have some scripts which begin:
> >
> > #!/bin/mawk -We
> >
> > Mawk is symlinked to /bin/gawk, which does not recognize the -We
> > parameter. Nearest I can figure, -We causes mawk to read the rest of the
> > file as its input. However, what happens is that this script tries to
> > take the first command line argument and run it as a script (which it
> > isn't). This is mostly likely because it doesn't recognize the -We
> > option. Since gawk does not recognize this option, and since I can't
> > find anything analogous in the gawk man page, I'm wondering how to make
> > this work.
> >
> > In sum, I need to know how to make these scripts read themselves as
> > script input. Any ideas?
> >
> > Paul
>
> I'm no awk guru, but.....
>
> Have you tried:
> #!/bin/gawk -f
> { actions... }
>
> $ thescript file
>
> This executes as
> /bin/gawk -f thescript file
>
> -Robert

And the winner is... Robert. That worked, though it's by no means
evident from the man page. Thanks.

Paul



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 16:59:20 EDT