LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-05-2015, 03:00 PM   #16
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,211

Rep: Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612

Which is why we have --include which allows this:

Code:
grep -Ri whatever --include \*.xml
 
1 members found this post helpful.
Old 10-05-2015, 03:13 PM   #17
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,716

Rep: Reputation: 1282Reputation: 1282Reputation: 1282Reputation: 1282Reputation: 1282Reputation: 1282Reputation: 1282Reputation: 1282Reputation: 1282
Quote:
Originally Posted by rtmistler View Post
Not to hi-jack the thread, this is actually related though. Can you, or someone explain why grep won't work with "*.xml" but does work fine with . (DOT), and actually * (STAR), but "*.*" or "*.xml" do not work. Meanwhile the find works fine.
The grep is told to recurse into directories... but the "*.xml" is not a directory.

In the context of the command
Code:
grep -Ri "num-samples" "*.xml" | wc -l
The search term is num-samples (where is should be num_samples), but the "*.xml" is interpreted to be the file to be searched (which most likely does not exist).
 
1 members found this post helpful.
  


Reply

Tags
scripting, shells


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] can i write a shell script in /etc/init.d that will run a python script? lapishater276 Debian 1 06-27-2014 03:23 PM
SHELL SCRIPT Write at the right of the shell window solo9300 Linux - General 3 09-29-2009 04:56 PM
How to ssh from a shell script ? For ppl who can write shell scripts. thefountainhead100 Programming 14 10-22-2008 06:24 AM
[SHELL SCRIPT] Write at the right of the shell window Creak Linux - General 2 04-02-2004 03:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration