- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- find files
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
12-20-2007 12:08 AM
12-20-2007 12:08 AM
find files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2007 12:32 AM
12-20-2007 12:32 AM
Re: find files
Hope this help.
BR,
Kapil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2007 12:35 AM
12-20-2007 12:35 AM
Re: find files
try:
$ cd /your/dir
# # first find those having abc or def
$ find . -type f -exec grep -l -E "abc|def" {} \+ > files-with-abc-def
# # now throw away those having ghi or jkl:
$ cat files-with-abc-def | xargs grep -l -E -v "ghi|jkl"
rgds
HGH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2007 01:20 AM
12-20-2007 01:20 AM
Re: find files
Kapils solution finds files with names matching your patterns:
you can use even simpler:
$ ls *abc* *def* | grep -E -v "ghi|jkl"
My solution works on file DATA, i.e. lists names of files (not) containing your patterns.
rgds
HGH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2007 02:16 AM
12-20-2007 02:16 AM
Re: find files
The below script is fine.
ls -lrt|egrep "abc|def" * |egrep -v "ghi|jkl"
I want to ask again, if the "abc" that I want to find is a word not string , that mean there should be space behind and ahead the word "abc" , can advise what can i do ? thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2007 02:33 AM
12-20-2007 02:33 AM
Re: find files
use grep with parameter -w
from grep(1) manpage:
-w
Select only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word-constituent characters are letters, digits, and the underscore.
rgds
HGH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2007 03:33 AM
12-20-2007 03:33 AM
Re: find files
What you mean by word...I think word itself is a string.
And if you grep in double coats it would work I suppose.
BR,
Kapil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2007 05:46 AM
12-20-2007 05:46 AM
Re: find files
# ls -lrt|egrep " (abc|def) " * |egrep -v " (ghi|jkl) "
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2007 07:27 PM
12-20-2007 07:27 PM