Re: piped system commands

2004-01-04 Thread deb
John, thanks for the perl approach. Mustn't forget about that! deb At 20:59:59, on 01.02.04: Cracks in my tinfoil beanie allowed John W. Krahn to seep these bits into my brain:, Deb wrote: I want to run a command inside a script. From the shell, here's the command: % ps -ef |

Re: piped system commands

2004-01-02 Thread John W. Krahn
Deb wrote: I want to run a command inside a script. From the shell, here's the command: % ps -ef | /bin/egrep '/usr/lib/sendmail' | /bin/grep -v grep | /bin/awk '{print $2}' 19460 open PS, 'ps -ef |' or die Cannot open pipe from 'ps -ef' $!; my $pid; while ( PS ) { next unless

Re: piped system commands

2003-12-31 Thread deb
At 17:50:40, on 12.30.03: Cracks in my tinfoil beanie allowed Andrew Gaffney to seep these bits into my brain:, Try changing the $2 to \$2. Perl is interpolating $2 before it gets to bash, so bash sees /bin/awk '{print }'. -- Andrew, Ah!!! That was it. I should have seen that. Thanks

Re: piped system commands

2003-12-31 Thread deb
At 15:58:26, on 12.30.03: Cracks in my tinfoil beanie allowed Bakken, Luke to seep these bits into my brain:, Instead of the useless 'grep -v grep', do this: % ps -ef | egrep '[/]usr/lib/sendmail' | awk '{print $2}' Ah, yes, much cleaner. Old habits die hard. :-) But, when I put this

Re: piped system commands

2003-12-31 Thread drieux
On Dec 31, 2003, at 9:04 AM, deb wrote: Drieux, Vladimir??? yes, named after vladimir ilyich, it is my Sparc Box. :-) Thanks for the hints. :-) Personally I would be doing it with something like http://www.wetware.com/drieux/CS/Proj/Wetware_ps/ Which of course first started out as

Re: piped system commands

2003-12-30 Thread Andrew Gaffney
deb wrote: Happy Almost New Year! I want to run a command inside a script. From the shell, here's the command: % ps -ef | /bin/egrep '/usr/lib/sendmail' | /bin/grep -v grep | /bin/awk '{print $2}' 19460 What is returned is the pid of the process being grep'd. But, when I put this into a test

RE: piped system commands

2003-12-30 Thread Bakken, Luke
I want to run a command inside a script. From the shell, here's the command: % ps -ef | /bin/egrep '/usr/lib/sendmail' | /bin/grep -v grep | /bin/awk '{print $2}' 19460 Instead of the useless 'grep -v grep', do this: % ps -ef | egrep '[/]usr/lib/sendmail' | awk '{print $2}' But, when

Re: piped system commands

2003-12-30 Thread drieux
On Dec 30, 2003, at 3:54 PM, deb wrote: Happy Almost New Year! [..] It seems to be only going as far as dropping off the grep, and not doing the awk '{print $2}'. I've tried this with the system() call, with the same results. What am I missing? :-( you have a shell interpret who to which