On May 15, 2004 05:32 pm, s. keeling wrote:
> Incoming from s. keeling:
> > Incoming from Nick W:
> > > ps -e | awk '$4 ~ /xmms/ {print $1 | "echo"}'
> > >
> > > echos a blank line, but no error.
> >
> > Compare this:
> >
> >    ps -e | awk 'BEGIN {ORS=" "} $4 ~ /xmms/ {print $1"\n" ; echo "$1\n"}'
> >
> > >From that I get the process number on a line by itself.  Where is the
> >
> > "print $1" going?  Standard output?  Where's echo's $1 coming from;
> > print or awk?
>
> Change that "print $1" to "print $1 * 2" and you'll see the echo is
> just swallowed, the "print" is what's producing output, and changing
> the ";" to an "|" swallows everything.

ok, but why? Why is it swallowed when I pipe it into echo, but works correctly 
when piped into sort? A different but similar example, lets say I wanted to 
remove all the backup files from a given directory...

ls -la | awk 'BEGIN {ORS=" "} $9 ~ /~/ {print $9}'

lists the files, but

ls -la | awk 'BEGIN {ORS=" "} $9 ~ /~/ {print $9 | "echo"}'

outputs nothing. Shouldn't the print output be piped into echo? It is with 
sort...



-- 
Nick W ([EMAIL PROTECTED])
Registered Linux User #324288 (http://counter.li.org)
MSN Messenger: [EMAIL PROTECTED]
Yahoo: foolish_gambit
ICQ: 303276221

_______________________________________________
clug-talk mailing list
[EMAIL PROTECTED]
http://clug.ca/mailman/listinfo/clug-talk_clug.ca

Reply via email to