Mr. Shawn H. Corey wrote:
On Fri, 2008-08-01 at 11:16 +0100, Rob Dixon wrote:
Mr. Shawn H. Corey wrote:
    next if /grep/;
No. The op was using grep to filter processes from the output of ps. he had a
filter of

  grep -v grep

so that the filter itself wouldn't be selected. John is using perl to filter the
processes, so instances of grep shouldn't be filtered out.

Yes.  `grep -v grep` filters out all occurrences of 'grep' not just
`grep perl`.  To get the equivalent, this line is required.

The OP was using:

ps -U oraoneload_beta  -u oraoneload_beta u | grep perl | grep -v grep

If you used the shell at all you would know that the second grep is there to remove the line that the first grep generates. You could achieve the same result with:

ps -U oraoneload_beta  -u oraoneload_beta u | grep pe[r]l

Because grep pe[r]l matches perl but not pe[r]l.

Also because I used the ps switch '-o command' instead of the OP's 'u' switch the pattern should probably be anchored at the beginning of the string anyway:

    next unless /^perl/;



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to