Xref: utzoo comp.unix.shell:1459 comp.unix.programmer:1062 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!randvax!segue!jim From: jim@segue.segue.com (Jim Balter) Newsgroups: comp.unix.shell,comp.unix.programmer Subject: Re: printing from awk into the stderr Keywords: awk Message-ID: <6189@segue.segue.com> Date: 11 Feb 91 02:20:51 GMT References: <728@mlacus.oz> <785@rubikon.UUCP> Reply-To: jim@segue.segue.com (Jim Balter) Organization: Segue Software, Inc. - Santa Monica, CA. +1-213-453-2161 Lines: 15 In article <785@rubikon.UUCP> toad@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.