On May 15, 2004 03:04 pm, s. keeling wrote:
> Incoming from Nick W:
> > Trying to learn AWK for no particular reason, but why does this not work?
> >
> > ps -e | awk 'BEGIN {ORS=" "} $4 ~ /xmms/ {print $1 | "kill"}'
> >
> > I get a broken pipe error:
> >
> > kill: usage: kill [-s sigspec | -n signum | -sigspec] [pid | job]... or
> > kill -l [sigspec]
>
> "kill" wants to know what to kill.  Or, did you mean
>
>    ... {print $1|print "kill"}'
>
> While building this, I'd replace that "kill" with echo until you know
> what it's going to do.

If I pipe it into echo it echos a blank line and then I get a broken pipe 
again. But if I just do:

ps -e | awk 'BEGIN {ORS=" "} $4 ~ /xmms/ {print $1}'

the output is correct, something like:

4671 4672 4673 4679 7200 7201

but lets say I use sort [without setting ORS]:

 ps -e | awk '$4 ~ /xmms/ {print $1 | "sort -rn"}'
7213
7212
4679
4673
4672
4671

it's correct.

ps -e | awk '$4 ~ /xmms/ {print $1 | "echo"}'

echos a blank line, but no error.

hrmm, still lost.


-- 
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