Article View: comp.unix.admin
Article #4031Re: Yet another Q. about 'grep'
From: Wayne Throop
Date: Tue, 14 Jul 1998 00:00
Date: Tue, 14 Jul 1998 00:00
38 lines
2183 bytes
2183 bytes
:: Gitte T gersen
:: Hi everybody,
"Hi Doctor Nick!"
(Sorry. Simpsons flashback. I'm better now.)
:: I you are going to do a
:: ps -ef | grep 'something'
:: and you don't wanna see the grep 'something',
:: but only the true result - what are you going to write
:: to left out the 'grep' line ??????
: Christian Tremblay <chris@terax.com>
: ps -ef | grep 'something' | grep -v grep
Or, since what you do is ensure the ps process doesn't include
the grep process in the ultimate output, ensure the grep isn't
running when the ps runs. I have a pipe fitting for that,
ps -ef | pseq | grep something
(where "pseq" acts like (cat >tmp; cat tmp; rm tmp))
or (in this particular case) just delay the start of the grep a bit
ps -ef | (sleep 5; grep something)
Just some alternatives.
Note, I made myself a pseq when I had a case where a writer blew up
ungracefully if ever a reader of its stdout didn't read all the way
to the end (that is, behaved ungracefully upon receipt of a SIGPIPE).
Thus, the pipe fitting to make an panic-prone writer cooperate
with a lazy reader; also useful in this case.
--
Wayne Throop throopw@sheol.org http://sheol.org/throopw
Technical Details
Message-ID:
<900456269@sheol.org>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6of1oa$e52$1@news.uni-c.dk> <Pine.SV4.3.96.980714174758.15112A-100000@terax.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f8c9b,54c788f7d8e9c885 X-Google-Attributes: gidf8c9b,public X-Google-Thread: fc89c,54c788f7d8e9c885 X-Google-Attributes: gidfc89c,public X-Google-Thread: f72b0,54c788f7d8e9c885 X-Google-Attributes: gidf72b0,public X-Google-Thread: 10e23a,54c788f7d8e9c885 X-Google-Attributes: gid10e23a,public X-Google-Thread: 11035d,54c788f7d8e9c885 X-Google-Attributes: gid11035d,public X-Google-Thread: 1020c6,54c788f7d8e9c885 X-Google-Attributes: gid1020c6,public From: throopw@sheol.org (Wayne Throop) Subject: Re: Yet another Q. about 'grep' Date: 1998/07/14 Message-ID: <900456269@sheol.org> X-Deja-AN: 371510408 Distribution: world References: <6of1oa$e52$1@news.uni-c.dk> <Pine.SV4.3.96.980714174758.15112A-100000@terax.com> Organization: sheol Newsgroups: comp.unix.admin,comp.unix.misc,comp.unix.programmer,comp.unix.questions,comp.unix.solaris,dk.edb.unix