Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find statement

Status
Not open for further replies.

teser

Technical User
Mar 6, 2001
194
0
0
US
I have a find statement with awk that works but I want to eliminate the permission denied output messages such as this example: find: cannot read dir ./proc/449: Permission denied. They seem to come up with some of my searches. My find
does get the data I need but I dont want to see these Permission denied messages coming up on my screen.

Here is the find statement:
[tt]
find . -name "$dat" -exec ls -Fd {} \; | awk '{.............}'[/tt]

I have tried fitting in the [tt] 2> /dev/null[/tt] in my find statement but it still shows the permission denieds on my find.

Any suggestions??
 
Could you pipe it further to or through a grep -v 'permission' or similar? HTH.
 
You could also "prune" the proc directories from the find command itself.

stan
 
I tried the [tt]grep -v 'permission'[/tt] such as:
[tt]find . -name "$dat" -exec ls -Fd {} \; | grep -v 'permission denied' | awk '{...}'[/tt]
but still got the messages. How does "prune" work?
 
how about
find . -path './proc' -prune -o -name "$dat" -exec ....

hth
stan
 
Try this with parantheses.

(find . -name "$dat" -exec ls -Fd {} \; | awk '{.............}') 2>/dev/null
 
I note that in your grep you have 'permission denied'. Try with 'Permission denied', ie exactly as in the error message. HTH.
 
You could do something like this ...

find . -name "$dat" -exec ls -Fd {} \; 2>/dev/null | awk '{.............}'

This should work.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top