- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: recursive grep
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
Discussions
Discussions
Discussions
Forums
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
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
тАО10-31-2003 02:21 AM
тАО10-31-2003 02:21 AM
Singaram
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-31-2003 02:24 AM
тАО10-31-2003 02:24 AM
Re: recursive grep
for _FILE in `ls -R /dir/path`; do
grep $_STRING $_FILE >>$_GREP.OUT
done
where /dir/path is the starting directory you want to search in, _GREP.OUT is a file that you want the output to go to and _STRING is the value you are searching on.
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-31-2003 02:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-31-2003 02:25 AM
тАО10-31-2003 02:25 AM
Re: recursive grep
use grep -l rather than just grep.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-31-2003 02:45 AM
тАО10-31-2003 02:45 AM
Re: recursive grep
gnugrep -r "pattern"
And all files in all sub-dirs will be searched.
I wish HP would include this as part of the base OS.
HTH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-31-2003 02:45 AM
тАО10-31-2003 02:45 AM
Re: recursive grep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-31-2003 03:18 AM
тАО10-31-2003 03:18 AM
Re: recursive grep
I used find / 2>/dev/null | xargs grepl -l word 2>/dev/null
Is there any way to avoid 2>/dev/null two times (One for find and one for grep)
Singaram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-31-2003 04:46 AM
тАО10-31-2003 04:46 AM
Re: recursive grep
you can execute it as a group command, e.g.:
# (find / -type f | xargs grep -l word )2>/dev/null
the "type -f" is good to include as it makes find skip reading directory files.
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-02-2003 04:32 AM
тАО11-02-2003 04:32 AM
Re: recursive grep
find "path_dir" -exec grep "word_find" {} \;
Bruno