Re: Antwort: greping stderr

From: Dave Simmonds (dave.simmonds@FORTEL.COM)
Date: Mon Dec 16 2002 - 09:08:22 EST


ls file1 file2 2>&1 >stdout-file | grep -v pattern >stderr-file

You need to do the 2>&1 BEFORE redirecting stdout (even if you didn't want
to redirect stdout, you will have to do so)

Dave Simmonds

 -----Original Message-----
From: Holger.VanKoll@SWISSCOM.COM [mailto:Holger.VanKoll@SWISSCOM.COM]
Sent: 16 December 2002 13:44
To: aix-l@Princeton.EDU
Subject: Re: Antwort: greping stderr

well; yes.

maybe I should explain better what I want.

I run filemon (or netpmon).
It prints things like "reporting started" etc. to stderr.
stderr is redirected to /some/file
I dont want these "reporting started" etc. things every time it runs.
So I want to grep it out.

"Real" (other) errors should however get to the errorfile that stderr is
redirected to.

-----Original Message-----
From: Volker Gruenewald [mailto:Volker.Gruenewald@LINDE-MH.DE]
Sent: Monday, December 16, 2002 2:34 PM
To: aix-l@Princeton.EDU
Subject: Antwort: greping stderr

Hello,

ls file1 file2 2>/dev/null

will get the result you are looking for

regards,

---------------------------------------------------
Volker Grünewald
IT Administration
Linde AG, material handling
Aschaffenburg / Germany
volker.gruenewald@linde-mh.de
www.linde.com
---------------------------------------------------

|---------+--------------------------->
| | Holger.VanKoll@S|
| | WISSCOM.COM |
| | Gesendet von: |
| | IBM AIX |
| | Discussion List |
| | <aix-l@Princeton|
| | .EDU> |
| | |
| | |
| | 12/16/02 12:44 |
| | PM |
| | Bitte antworten |
| | an IBM AIX |
| | Discussion List |
| | |
|---------+--------------------------->

>---------------------------------------------------------------------------
----------------------------------------------------|
  |
|
  | An: aix-l@Princeton.EDU
|
  | Kopie:
|
  | Thema: greping stderr
|

>---------------------------------------------------------------------------
----------------------------------------------------|

Hello,

can I grep stderr of a command without a 2>&1 ?

F.e. if file1 exists and file2 doesnt,

ls file1 file2 |"errgrep" file2

should give file1 on stdout and nothing on stderr.

Regards,

Holger

This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden. Any views expressed in this message are those
of the individual sender, except where the sender specifically states
them to be the views of Linde Material Handling.

Since January 2002 we use the e-mail domain linde-mh.de instead of
linde-fh.de.

This mail has been swept for the presence of computerviruses.



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:24 EDT