The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
shell script to search content of file with timestamps in the directory psychobeauty Shell Programming and Scripting 10 04-21-2008 02:37 AM
Perl: Search for string on line then search and replace text Crypto Shell Programming and Scripting 4 01-04-2008 07:24 AM
grep/cat/more -- search in a txt file and display content from a specific "keyword" I-1 UNIX for Dummies Questions & Answers 4 02-21-2007 01:57 AM
How to search files containing a specific word in the content amjath78 UNIX for Dummies Questions & Answers 1 01-03-2007 12:42 PM
Advanced Search Problems.. Search by User Name Neo Post Here to Contact Site Administrators and Moderators 1 05-18-2003 09:28 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-14-2008
Registered User
 

Join Date: Jul 2008
Posts: 2
Search files with specfic extention and later search content

Hi,

I would appriciate if somebody can help me figure out how to search for all the *.xml file under a specific directory and subdirectroies (/home/username) and later search of content "<start>" inside the xml file returned by search.


-Lovin.V
Reply With Quote
Forum Sponsor
  #2  
Old 07-14-2008
radoulov's Avatar
addict
 

Join Date: Jan 2007
Location: Milano, Italia/Варна, България
Posts: 1,931
Code:
find /home/username -name '*.xml' -exec grep '<start>' {} +
If your find does not support the + syntax, try this:

Code:
find /home/username -name '*.xml'|xargs grep '<start>'
It should be more efficient than:

Code:
find /home/username -name '*.xml' -exec grep  '<start>' {} \; -print
But you should modify it if the filenames contain spaces or other pathological characters.
Reply With Quote
  #3  
Old 07-14-2008
Registered User
 

Join Date: Jul 2008
Posts: 2
Awesome.. You nailed it.

Thanks,
Lovin.V
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 02:58 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0