- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Bug with find?
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
06-02-2005 11:21 PM
06-02-2005 11:21 PM
When I do:
#find disc2 -name *.sh -exec grep -l EOT {} \;
I get only 1 file:
disc2/.../scripts/job.sh
But I've more scripts in disc2 with the word EOT...
Any idea??
Thanks,
Eric Antunes
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 11:27 PM
06-02-2005 11:27 PM
Re: Bug with find?
Does it make any difference if you quote your grep argument:
grep -l 'EOT' {} \;
How about if you use xargs instead:
find disc2 -name *.sh | xargs grep -l 'EOT'
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 11:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 11:34 PM
06-02-2005 11:34 PM
Re: Bug with find?
ll *.sh
ll disc2/*.sh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 11:34 PM
06-02-2005 11:34 PM
Re: Bug with find?
Sames results:
# find disc2 -name *.sh -exec grep -l 'EOT' {} \;
disc2/app/oracle/admin/TST/scripts/job.sh
# find disc2 -name *.sh |xargs grep -l 'EOT'
disc2/app/oracle/admin/TST/scripts/job.sh
I'm sure of this because I've lots of db scripts using svrngrl, i. e., with this line:
...
svrmgrl << EOT
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 11:36 PM
06-02-2005 11:36 PM
Re: Bug with find?
find disc2 -name "*\.sh" -exec grep -l EOT {} \;
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 11:36 PM
06-02-2005 11:36 PM
Re: Bug with find?
You should run
find disc2 -name '*.sh' -exec grep -l EOT {} \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 11:40 PM
06-02-2005 11:40 PM
Re: Bug with find?
But why I need to use "*\.sh" or "*.sh"??
Thanks,
Eric
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 11:41 PM
06-02-2005 11:41 PM
Re: Bug with find?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 11:42 PM
06-02-2005 11:42 PM
Re: Bug with find?
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 11:42 PM
06-02-2005 11:42 PM
Re: Bug with find?
Single quotes or double quotes prevent shell filename expansion.
You'll obtain the same result by disabling the shell expansion:
set -f
find disc2 -name *.sh -exec grep -l EOT {} \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 11:45 PM
06-02-2005 11:45 PM
Re: Bug with find?
File Name Generation
Following substitution, each command word is processed as a pattern
for file name expansion unless expansion has been disabled with the
set -f special command.
You thought you ran
find disc2 -name *.sh -exec grep -l EOT {} \;
but after shell filename expansion the real command launched was
find disc2 -name job.sh -exec grep -l EOT {} \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2005 12:10 AM
06-03-2005 12:10 AM
Re: Bug with find?
#mv job.sh jobe.sh
I get no results:
#find disc2 -name *.sh -exec grep -l 'EOT' {} \;
#
Is this because of job being a reserved word??
Eric
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2005 12:12 AM
06-03-2005 12:12 AM
Re: Bug with find?
I've got it: I have a job.sh script in root's home directory...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2005 12:13 AM
06-03-2005 12:13 AM
Re: Bug with find?
find disc2 -name sh -exec grep -l 'EOT' {} \;
You have to pattern matching characters in quotes unless you want them to be expanded by the SHELL.
and a period is a pattern matching character also, so you need to escape it out:
"*\.sh"
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2005 12:15 AM
06-03-2005 12:15 AM
Re: Bug with find?
You have to PUT pattern matching characters in quotes unless you want them to be expanded by the SHELL.
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2005 03:55 AM
06-03-2005 03:55 AM