I started using sed
recently. One handy way I use it is to ignore unimportant lines of a log file:
tail -f example.com-access.log | sed '/127.0.0.1/d;/ELB-/d;/408 0 "-" "-"/d;'
But when I try to use it similarly with find
, the results aren't as expected. I am trying to ignore any line that contains "Permission denied" like this:
find . -name "openssl" | sed '/Permission denied/d;'
However, I still get a whole bunch of "Permission denied" messages in stdout
.
EDIT
As mentioned in the correct answer below, the "Permission denied" messages are appearing in stderr
and NOT stdout
.
grep
/egrep
. – Michael Hampton Jul 10 '13 at 2:13grep
would help me out here. – Ben Harold Jul 10 '13 at 2:14-v
) – Andrew B Jul 10 '13 at 2:53find . -name "openssl" 2>&1 | grep -v "Permission denied"
– Andrew B Jul 10 '13 at 4:35