The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
search pattern in a string and rename deepakgang UNIX for Dummies Questions & Answers 6 06-02-2008 01:43 AM
Compare string to a pattern jerryte Shell Programming and Scripting 2 01-25-2008 08:37 PM
Advance string pattern search Please sainj Shell Programming and Scripting 2 10-30-2007 10:56 AM
how to get the last part of a string followed by a pattern bluemoon1 Shell Programming and Scripting 4 09-08-2007 11:10 AM
how to know if a string contains a certain pattern Deanne Shell Programming and Scripting 11 08-09-2007 08:19 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-24-2007
amit4g's Avatar
amit4g amit4g is offline
Registered User
  
 

Join Date: Apr 2006
Location: Bangalore,India
Posts: 29
locating a string pattern in a tree

Hi,

How can i find a specific string pattern in the entire tree(several directories containing multiple sub directories ) ?
$ find ./ -type f |grep "<pattern>" will not do as it will just give the names of directories (relative pathname containing the pattern).

grepping for the pattern in a directory containing files only work,but this is not what i want.
i need to look for the specific <pattern> in the entire tree .

"xargs" might do the job,but i've never used it before : (

Thanks,
~amit
  #2 (permalink)  
Old 05-24-2007
amit4g's Avatar
amit4g amit4g is offline
Registered User
  
 

Join Date: Apr 2006
Location: Bangalore,India
Posts: 29
i guess i found what i was looking for
find ./ -type f|xargs grep <pattern>|more
  #3 (permalink)  
Old 05-24-2007
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
Code:
find . -type f -exec grep "<pattern>" {} \;
Code:
find . -type f | xargs grep "<pattern>"
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:07 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0