| Walt Mankowski on Sun, 26 Jan 2003 23:41:05 -0500 |
|
On Sun, Jan 26, 2003 at 10:44:26PM -0500, Jeff Abrahamson wrote:
> I have a canned awk script that I want to put in a file rather than a
> shell function. Should work, start the file
>
> #!/usr/bin/awk
>
> (I've verified that that's awk.)
>
> I get the error
>
> jeff@asterix:Research $ ./left-column
> awk: 1: unexpected character '.'
> jeff@asterix:Research $ cat left-column
> #!/usr/bin/awk
> jeff@asterix:Research $
>
> Even if the "#!..." is the only line in the file.
>
> Any ideas what I'm doing wrong?
I haven't done much awk, but it appears that awk doesn't read the
program code from stdin. You either need to enter the code on
the awk command line as a one-liner:
% awk 'BEGIN {print "hello, world"}'
or give the program as a command-line parameter:
% awk -f hello.awk
In either case, stdin is used as the default input, not the default
location of the source code.
> I know, I should just use perl for this, but awk would have worked...
I promise to not report you to the Perl police. :)
Walt
Attachment:
pgpbm4iZ0k5Qc.pgp
|
|