The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Recursive FTP -- here at last. Perderabo Shell Programming and Scripting 48 4 Weeks Ago 07:56 AM
Recursive grep upstate_boy UNIX for Dummies Questions & Answers 16 05-18-2008 02:16 PM
recursive grep issue Mace UNIX for Dummies Questions & Answers 1 08-11-2006 04:39 AM
grep recursive directories jagannatha UNIX for Dummies Questions & Answers 8 07-24-2003 01:00 PM
Recursive FTP aslamg UNIX for Dummies Questions & Answers 1 03-08-2001 12:27 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-21-2003
alan's Avatar
Registered User
 

Join Date: Jul 2003
Location: Los Angeles
Posts: 53
Stumble this Post!
recursive GREP ?

Hi! Suppose I have a directory (no symbolic links) called /WORK that contains 3 subdirectories:
/A
/B
/C

My problem is this: I want to look for a file that contains an order number. So far, I obtain what I want by doing this

[acb@k9]/home/acb% cd /WORK/A
[acb@k9]/home/acb/WORK/A% grep '093023553' *.*
[acb@k9]/home/acb/WORK/A% cd ..
[acb@k9]/home/acb% cd /WORK/B
[acb@k9]/home/acb/WORK/B% grep '093023553' *.* ...etc

There's got to be a better way to do that, right? I believe I could do something like this to scan all my subdirectories:

[acb@k9]/home/acb/WORK/A% grep -"recursive" '093023553' *.*

Is GREP not suited for that? Should I use FIND instead?

Thanks in advance for helping!

Al.
Forum Sponsor
  #2 (permalink)  
Old 08-21-2003
Registered User
 

Join Date: Aug 2001
Posts: 179
Stumble this Post!
Take a look at the following thread

grep recursive directories
  #3 (permalink)  
Old 08-21-2003
alan's Avatar
Registered User
 

Join Date: Jul 2003
Location: Los Angeles
Posts: 53
Stumble this Post!
Thanks, sssow! I used

find . -exec grep -l '093023553' {} \; -exec grep '093023553' {} \;

and it did a great trick: listed my files containing my order number and the location of my order number in the files themselves!!!

Thank you!!

Al.
  #4 (permalink)  
Old 08-22-2003
pressy's Avatar
solaris cultist
 

Join Date: Aug 2003
Location: Vienna / Austria (Europe) [EARTH]
Posts: 712
Stumble this Post!
try this

fgrep */*/*/* 093023553
where * are your subdirectorys
Google The UNIX and Linux Forums
Closed Thread

Tags
grep, grep recursive, recursive grep

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:16 AM.


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

Content Relevant URLs by vBSEO 3.2.0