Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GAWK4: Possible to @include in a command line program?

25 views
Skip to first unread message

Kenny McCormack

unread,
Mar 23, 2013, 12:43:15 PM3/23/13
to
GAWK4: Possible to @include in a command line program?

I tried: gawk4 '@include "something.awk"; BEGIN ...'

and variations thereof, but with no success. This all works fine if I put
it into a file and call it, of course.

Error messages are all of the "syntax error"/unrecognized-symbol variety.

--
They say compassion is a virtue, but I don't have the time!

- David Byrne -

Aharon Robbins

unread,
Mar 23, 2013, 2:54:34 PM3/23/13
to
In article <kikm33$m68$1...@news.xmission.com>,
Kenny McCormack <gaz...@shell.xmission.com> wrote:
>GAWK4: Possible to @include in a command line program?
>
>I tried: gawk4 '@include "something.awk"; BEGIN ...'
>
>and variations thereof, but with no success. This all works fine if I put
>it into a file and call it, of course.
>
>Error messages are all of the "syntax error"/unrecognized-symbol variety.

Works for me:

$ gawk --version | sed 1q
GNU Awk 4.0.0
$ cat foo1.awk
BEGIN { print "this is foo" }
$ gawk '@include "foo1.awk" ; BEGIN { print "hi" }'
this is foo
hi

If you are on Windows and not using a POSIX shell, you may have
quoting issues, but I would have thought that you are well aware of
such things.

Arnold
--
Aharon (Arnold) Robbins arnold AT skeeve DOT com
P.O. Box 354 Home Phone: +972 8 979-0381
Nof Ayalon
D.N. Shimshon 9978500 ISRAEL

Kenny McCormack

unread,
Mar 23, 2013, 3:43:27 PM3/23/13
to
In article <kiktpa$4mt$1...@dont-email.me>,
Aharon Robbins <arn...@skeeve.com> wrote:
>In article <kikm33$m68$1...@news.xmission.com>,
>Kenny McCormack <gaz...@shell.xmission.com> wrote:
>>GAWK4: Possible to @include in a command line program?
>>
>>I tried: gawk4 '@include "something.awk"; BEGIN ...'
>>
>>and variations thereof, but with no success. This all works fine if I put
>>it into a file and call it, of course.
>>
>>Error messages are all of the "syntax error"/unrecognized-symbol variety.
>
>Works for me:

Indeed it does. At least in the simple cases.

My test case was a bit complex - and I'll have to work it up a bit at some
point to see if it still fails. As it was all on the command line, and my
machine has been rebooted, it will take work to re-create it. Anyway, glad
to know that it does work (at least in the basic cases).

P.S. I'm aware that this can be work-arounded by using multiple "-f"
options (or --source).

--
"That's the eternal flame."[7] The single became another worldwide hit.[8]

Hoffs was actually naked when she recorded the song, after being convinced
by Sigerson that Olivia Newton-John got her amazing performances by
recording everything while naked.[9]

(From: http://en.wikipedia.org/wiki/The_Bangles)

0 new messages