On Dec 11, 2007 7:46 PM, Pietro Gagliardi <[EMAIL PROTECTED]> wrote:
> Not in this case, no. The format of awk is
>
> awk 'program' files
> awk -f prgm files
>
> What I could do instead is
>
> u=/tmp/$0$pid$apid$0
> cat > $u <<\END
> program
> END
> awk -f $u $*
> rm $u
>
> but I'd rather not go that way to avoid possible collisions.
actually, you could use a here file and a named pipe:
awk -f <{cat << 'EOF'} $*
program
EOF
i do think that a quoted argument should be able
to take an arbitrary amount of text though.
> Here's another problem. The error check function cats to [1=2].
> However, instead of going to standard output, it makes a file [1=2]
> and writes the message there. How do I fix this?
awk uses ape/sh to run its commands, so you can fix it
by using >&2 as under unix.
On Dec 12, 2007 10:14 AM, Douglas A. Gwyn <[EMAIL PROTECTED]> wrote:
> Another similar approach would be for the open of a new special
> file to create a unique temp file, which would vanish upon final
> close, and have the app share/clone the file descriptor, which
> could be dup2()ed (or whatever Plan9 equivalent is) to stdout,
> stdin, etc., for the various processes in your script.
that's similar to the named-pipe approach, except that you can't
seek on named pipes. i often find myself mounting
a new instance of ramfs, thus getting rid of the problem in most
cases (the exception being if you don't want to fork the namespace).