The UNIX and Linux Forums  

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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
csh syntax charlie11k UNIX for Dummies Questions & Answers 0 05-31-2007 11:29 PM
vim and syntax max os kezzol OS X (Apple) 1 04-30-2007 11:22 AM
What does this syntax mean... DrAwesomePhD UNIX for Dummies Questions & Answers 1 07-31-2006 08:54 AM
Need help with the syntax using awk+grep kthri Shell Programming and Scripting 6 11-07-2005 01:01 AM
correct syntax for using "grep regex filename" ? yongho UNIX for Dummies Questions & Answers 2 06-13-2005 11:44 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-19-2007
Registered User
 

Join Date: Dec 2006
Posts: 16
Talking grep syntax for this...

I wanna grep for a pattern logs 1 2 & 3 within a folder containing 100 logs

grep "test" /folder/log1 /folder/log2 /folder/log3

The above command will work fine


but is there any command like

grep "test" /folder/log1, log2, log3 or something similar
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-19-2007
Registered User
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,397
Code:
grep "test" /folder/log[1-3]
Reply With Quote
  #3 (permalink)  
Old 02-19-2007
Registered User
 

Join Date: Dec 2006
Posts: 16
Er..what if their names arent log1 log2 and log3....say if its xx yy zz..then???
Reply With Quote
  #4 (permalink)  
Old 02-19-2007
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,593
Since they are within a folder

run simple grep

Code:
grep "pattern" *.*
else

Code:
find . -type f -name '*.*' -print | xargs grep -il 'pattern'
Reply With Quote
  #5 (permalink)  
Old 02-19-2007
Registered User
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,397
Code:
grep "test" [a-z][a-z]
or
Code:
grep "test" ??
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:33 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 Global Fact Book

Content Relevant URLs by vBSEO 3.2.0