- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Searching all files in a directory
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
03-19-2002 12:22 PM
03-19-2002 12:22 PM
I need to figure out the quickest way to search an entire directory (/etc/lp/interface/model.orig) searching each and every file for which printers listed here have Banner="yes" as part of their file.
Can someone provide me a quick and dirty search command to do this?
Thanks all.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2002 12:32 PM
03-19-2002 12:32 PM
Re: Searching all files in a directory
#cat * |grep -i banner |grep yes
Works for me. I don't know this is the best way or not.
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2002 12:34 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2002 12:34 PM
03-19-2002 12:34 PM
Re: Searching all files in a directory
find /etc/lp/interface/model.orig -type f -exec grep -l "Banner=\"yes\"" {} \;
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2002 12:38 PM
03-19-2002 12:38 PM
Re: Searching all files in a directory
What is the purpose of the {}\ and putting the \yes\ with the \ in the command?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2002 12:38 PM
03-19-2002 12:38 PM
Re: Searching all files in a directory
# grep -r -a 'Banner="yes"' /etc/lp/interface/model.orig
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2002 12:39 PM
03-19-2002 12:39 PM
Re: Searching all files in a directory
You can do following :
1. cd /etc/lp/interface/model.orig
2. enter following command
grep \banner\=\"yes\" *
It will serve your purpose.
Thanks,
-Piyush.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2002 12:47 PM
03-19-2002 12:47 PM
Re: Searching all files in a directory
You could do this:
This will search recursively through all files in all subdirectories and will print the files which has that string on stdout.
The key here is /dev/null, this will list the files before the match.
find
The following will only grep text files (this way you don't get junk character on the screen as a result of grepping binaries)
grep "Banner=yes" `find
Hope this helps !
-Shabu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2002 12:49 PM
03-19-2002 12:49 PM
Re: Searching all files in a directory
Check the man pages of 'find' command. That will give you an explanation.
syntax is: -exec cmd
{} and \; should be used along with -exec option. {} replaces any command arguments by the current path. The end of cmd must be punctuated by a semicolon (;).
The other \" tells the command to consider " as a normal character.
HTH,
Shiju
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2002 12:52 PM
03-19-2002 12:52 PM
Re: Searching all files in a directory
FG.