Re: [SLUG] Awk Question

From: Robert Haeckl (rhaeckl@tampabay.rr.com)
Date: Tue Nov 06 2001 - 09:48:47 EST


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



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 16:56:55 EDT