- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to remove "find: cannot open"
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2005 04:28 AM
04-25-2005 04:28 AM
How to remove "find: cannot open"
I know this may sound a very silly question but whenever you are doing a find, and you don't have acess to a certain directory, you always get these kind messages:
find: cannot open ./etc/opt/...
find: cannot open ./etc/opt/resmon/...
How can I get rid of them so I will only display the files/directories that match my find?
Thanks a lot,
Javier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2005 04:29 AM
04-25-2005 04:29 AM
Re: How to remove "find: cannot open"
Pipe your find to a "grep -v cannot".
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2005 04:31 AM
04-25-2005 04:31 AM
Re: How to remove "find: cannot open"
The messages 'cannot open' signify a permission issue. Doing the find as a non-root user.
If true, the other option is to have find skip the areas it cannot open then those messages will not appear.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2005 04:33 AM
04-25-2005 04:33 AM
Re: How to remove "find: cannot open"
find . -print 2>/dev/null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2005 04:48 AM
04-25-2005 04:48 AM
Re: How to remove "find: cannot open"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2005 05:00 AM
04-25-2005 05:00 AM
Re: How to remove "find: cannot open"
find . -name "*.bsf" -exec grep -v "cannot" {} \;
or
find . -name "*.bsf" | grep -v cannot
find: cannot open ./etc/opt/resmon/persistence
find: cannot open ./etc/opt/resmon/pipe
find: cannot open ./etc/opt/sanmgr
find: cannot open ./etc/opt/hpsmc
find: cannot open ./etc/sam/custom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2005 05:03 AM
04-25-2005 05:03 AM
Re: How to remove "find: cannot open"
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2005 05:04 AM
04-25-2005 05:04 AM
Re: How to remove "find: cannot open"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2005 05:57 AM
04-25-2005 05:57 AM
Re: How to remove "find: cannot open"
messages go to stderr and pipe works on stdout, so
they still show up in your output. There are 2 solutions
to this. One, you could follow Clay's suggestion of
directing stderr to /dev/null. The other option is to
redirect stderr to stdout and then use "grep -v" to
remove the error messages.
# find . -name "*.bsf" 2>&1 | grep -v cannot
- Biswajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2005 04:49 PM
04-25-2005 04:49 PM
Re: How to remove "find: cannot open"
$ find
this is the best way suited for your need.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2005 05:23 PM
04-25-2005 05:23 PM
Re: How to remove "find: cannot open"
find
Else redirect all error messages to /dev/null simply as,
find
HTH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2005 03:21 AM
04-26-2005 03:21 AM
Re: How to remove "find: cannot open"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2005 03:51 AM
04-26-2005 03:51 AM
Re: How to remove "find: cannot open"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2005 03:56 AM
04-26-2005 03:56 AM
Re: How to remove "find: cannot open"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2005 06:22 AM
04-26-2005 06:22 AM
Re: How to remove "find: cannot open"
> On the other hand, the grep approach also has
> the unwanted side effect of filtering out any
> pathnames which happen to contain "cannot".
Yes. That could, ofcourse, be fixed with couple of
extra lines of script.
> You would be much better served to separate
> stdout and stderr and if you are interested in the
> error messages then capture stderr to a file and
> process it separately.
Agreed 100%. If the programmer wrote different
things to stdout and stderr, then it was for a reason.
- Biswajit