- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Is it possible to exclude some file extentions...
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
11-16-2005 02:54 AM
11-16-2005 02:54 AM
I'm searching for files with some words like
find
But I get lots of log and txt files that doesn't matter. Is it possible to exclude *.log and *.txt files?
Best Regards,
Eric Antunes
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 02:57 AM
11-16-2005 02:57 AM
Re: Is it possible to exclude some file extentions with find?
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 02:59 AM
11-16-2005 02:59 AM
Re: Is it possible to exclude some file extentions with find?
Why not simply grep -v those extensions?
Regards,
dl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 02:59 AM
11-16-2005 02:59 AM
Solutionpersonally, I would not use find at all.
# grep -r -l -e .... |
or perl -MFile::Find
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 03:00 AM
11-16-2005 03:00 AM
Re: Is it possible to exclude some file extentions with find?
find
Does it work,
HTH,
Devender
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 03:01 AM
11-16-2005 03:01 AM
Re: Is it possible to exclude some file extentions with find?
No points on this or the "same answer" reply.
dl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 03:05 AM
11-16-2005 03:05 AM
Re: Is it possible to exclude some file extentions with find?
find
However, you should really not grep anything except text files because on some UNIX flavors grep will crash on unexpected input (e.g. executables).
I would add a -type f filter to find to only allow regular files and then pass each candidate to a test using the file command piped to grep -i -q "text"
e.g.
file "${FNAME}" | grep -q -i "text"
STAT=${?}
if [[ ${STAT} -eq 0 ]]
then
echo "okay to grep"
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 03:07 AM
11-16-2005 03:07 AM
Re: Is it possible to exclude some file extentions with find?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 03:21 AM
11-16-2005 03:21 AM
Re: Is it possible to exclude some file extentions with find?
$find
Dave, I just gave you 5 more points but I assigned 5 first because you didn't post the command, exemplifying...
Many Thanks,
Eric Antunes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 03:25 AM
11-16-2005 03:25 AM
Re: Is it possible to exclude some file extentions with find?
Thanks again,
Eric Antunes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 03:42 AM
11-16-2005 03:42 AM
Re: Is it possible to exclude some file extentions with find?
$find
Is it possible to exclude files that contains this:
...
a VISION z
...
And return just those containing this kind of text:
...
a VIS z
...
??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 03:54 AM
11-16-2005 03:54 AM
Re: Is it possible to exclude some file extentions with find?
should do the trick.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 05:29 AM
11-16-2005 05:29 AM
Re: Is it possible to exclude some file extentions with find?
# perl -MFile::Find -le'$/=undef;find(sub{/\.(txt|log)$/ and return;@ARGV=($_);<>=~/VIS\b/ and print$File::Find::name},"DIR")'
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 10:00 PM
11-16-2005 10:00 PM
Re: Is it possible to exclude some file extentions with find?
I found an easy (I think) way to avoid executables:
... -a ! -path '*/bin/*' -a ...
Eric Antunes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 11:58 PM
11-16-2005 11:58 PM
Re: Is it possible to exclude some file extentions with find?
Merely because files are found in a path named 'bin' doesn't guarantee that they are executable binaries. The nomenclature is a suggested standard only, just like dot-extensions are informational only in UNIX.
If you want to test a file for its "magic" you need to use 'file' to determine its type. 'file' attempts to classify files.
See the man pages for 'file(1)' and for 'magic(4) for more information.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2005 12:21 AM
11-17-2005 12:21 AM
Re: Is it possible to exclude some file extentions with find?
Nevertheless, in my specific situation I'm pretty sure that files in directories like this:
-a ! -path '*/bin/*' -a ! -path '*/doc/*' -a ! -path '*/forms/*' -a ! -path '*/reports/*' -a ! -path '*/log/*' -a ! -path '*/out/*' -a ! -path '*/patch/*'
don't have what I'm looking for: variable definitions, configurations, etc...
Best Regards,
Eric Antunes