printing from awk into the stderr

Jim Balter jim at segue.segue.com
Mon Feb 11 13:20:51 AEST 1991


In article <785 at rubikon.UUCP> toad at rubikon.UUCP (Peter Cleve) writes:
|The standart (and portable) solution is :
|
|	print "foo bar" | "cat 1>&2"
|
|In nawk (comes with newer unix releases) or with gawk you can try :
|
|	print "foo bar" > /dev/stderr
|
|This solution does not have the overhead of starting a new process for
|every burst of output.

Nor does the "standard solution".  Try awk '{print | "wc"}' somefile.
awk keeps a table of the filenames and commands it has opened and only does the
open/popen the first time a particular filename or command is encountered.



More information about the Comp.unix.programmer mailing list