<quote who="Michael Ryan Byrd">
> So I decide I want to show all the index.html files on my system with:
>
> ls -alR |grep "index.html"
>
> (I could have used 'Find . -name "index.html" -print', but anyway.)
>
> The problem is that this command is not executed as root, so I'm going
> to get a bunch of errors like:
>
> ./apps/glta_v9.01/max2key/html: Permission denied
> ./apps/ami: Permission denied
> ./apps/amplify_v3.1/hp11/sms/copy_sms: Value too large for defined data
> type ./apps/apllo_backup: Permission denied
> ./apps/aptx_3.6a: Permission denied
>
> How do I filter out the system error messages?


The key is to redirect stderr to stdout and then grep, like so:

ls -alR 2>&1 |grep "index.html"

That way, you not only grep on stdout, but also stderr (which is where
your 'Permission denied' messages are coming from).

--Dave





____________________
BYU Unix Users Group 
http://uug.byu.edu/ 
___________________________________________________________________
List Info: http://phantom.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to