- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- grep file in the subdirectory
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
тАО09-29-2002 11:41 PM
тАО09-29-2002 11:41 PM
grep file in the subdirectory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-29-2002 11:44 PM
тАО09-29-2002 11:44 PM
Re: grep file in the subdirectory
To grep in all files in all subdirs;
grep
or
grep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-29-2002 11:47 PM
тАО09-29-2002 11:47 PM
Re: grep file in the subdirectory
find . -type f -exec grep -i pattern {} \;
This instruction searches in all subdirectories, in all files the pattern "pattern" (lower and upper cases)
Christian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-29-2002 11:48 PM
тАО09-29-2002 11:48 PM
Re: grep file in the subdirectory
find /var -name '*' -exec grep -i -l '15AUG00 16:38' {} \; > /tmp/output_file
This will find all files contained within the /var directory (and any subdirectories). Notice that the wildcard * is enclosed in single quotes. The output of the find is sent to a grep with a -i (case insensitive) and -l (ell) switch. The -l swich is necessary as this causes the grep to return the name of the file in which the search text was found (as opposed to simply returning a copy of the line itself).
In the above example, I have searched for the string '15AUG00 16:38' (note the single quotes again around the string) and sent the output to a file called /tmp/output_file.
Regards
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-30-2002 03:02 AM
тАО09-30-2002 03:02 AM