Re: Executable awk script



On Thu, 20 Oct 2005 07:33:39 -0700, corey lawson
<corey.lawson@xxxxxxxxxxxxx> wrote:

>Bill Seivert wrote:
>
>>
>>
>> mickey wrote:
>>
>>> Is there a way to turn a awk script into an executable so that you do
>>> not need to have awk installed to run it?
>>>
>>> Thanks,
>>>
>>> -M
>>
>>
>> #!/path/to/awk -f
>> BEGIN {
>> ...
>> }
>> etc.
>>
>> But awk still needs to be installed.
>>
>> Bill Seivert
>>
>
>...and the #! magic string doesn't work on Windows (but assigning .awk
>file extension to gawk.exe more or less ends up with the same result).

There are contexts in which it does, notably Apache CGI scripts.
>
>But who in their right mind would use gawk on Windows? Well, it makes
>analyzing and filtering text files (i.e., database table/view dumps)
>WAYYY easier and faster than linking to them via ODBC...

I use it for many CGI scripts because it is quite useful, and more
approachable than Perl. And if crafted carefully, are very portable
between XP and Linux (the trick is to make the script file have Unix
\n instead of Windows \r\n line endings).

--
T.E.D. (tdavis@xxxxxxxxxxxxxxxxxxxx)
SPAM filter: Messages to this address *must* contain "T.E.D."
somewhere in the body or they will be automatically rejected.
.



Relevant Pages

  • Re: How to rewrite with awk?
    ... > I'm unfamiliar with tools such as sed & awk. ... Extract the string that matches a RE. ... This script will not only expand all the lines that say "include ... file) and not resetting ARGV(the tmp file), it then lets awk do any ...
    (comp.unix.shell)
  • Re: Automatisierte TextVerarbeitung
    ... AWK - oder bessergesagt "awk" kam mir doch gleich irgendwie bekannt vor ... Einige kann man auch als exe fuer Windows beziehen ... Ich habe soeben ein altes mawk herausgekramt und ein mini-awk script, ... Betreff: Re: where are the binaries for GAWK? ...
    (microsoft.public.de.german.windowsxp.sonstiges)
  • Re: for loop (?)
    ... you should use awk variables in awk scripts instead ... >>of shell variables to avoid problems when those shell variables include ... I doubt if I've ever written a shell script that's robust ... > extra effort to make the script robust against weird inputs. ...
    (comp.unix.shell)
  • Re: How to remove all .DS_Store files using Terminal?
    ... Great tip, I will add that to my limited Unix arsenal, thanks. ... When I first saw this script, ... into an awk script. ... The conditional expression can be a search string as in /abc/ or a ...
    (comp.sys.mac.system)
  • Re: for loop (?)
    ... you should use awk variables in awk scripts instead ... > of shell variables to avoid problems when those shell variables include ... can handle NUL characters correctly in its input. ... pass these characters to the script in the first place. ...
    (comp.unix.shell)