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
Grep question. saurabhsinha23 UNIX for Dummies Questions & Answers 3 12-11-2007 01:58 AM
Question about GREP Adriel UNIX for Dummies Questions & Answers 16 03-22-2007 08:03 AM
Another grep question kingdbag UNIX for Dummies Questions & Answers 6 10-27-2006 02:56 AM
grep & sed question der Kopf Shell Programming and Scripting 1 11-22-2004 04:49 AM
Grep question eloquent99 UNIX for Dummies Questions & Answers 4 02-20-2003 10:49 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
  #1 (permalink)  
Old 06-28-2005
ANAMIKA56 ANAMIKA56 is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 7
question about grep

I want to search for a word from the root directory using grep command.
I am searching for a word called batch in cd /vol directory.The vol directory has so many sub-directories and I want to see all the files having the name as batch.
This what I tried ..
/vol/ % grep -i *batch*
But it is hanging ,and I didn't have anything returned.
Could someone help me out with this.


thanks.
  #2 (permalink)  
Old 06-28-2005
redlotus72 redlotus72 is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 69
use this

find . -type f|xargs grep -i <string>
  #3 (permalink)  
Old 06-28-2005
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131
find /vol -type f -name '*[Bb][Aa][Tt][Cc][Hh]*'
  #4 (permalink)  
Old 06-28-2005
rahul123_libra rahul123_libra is offline
Registered User
  
 

Join Date: May 2005
Posts: 46
Smile Use find instead

Hello

grep will take time because as u said there r many sub-directoires under the /vol directory .

It hangs because u have not specified any dir from which it would read
so it waits for some input from the standard input .

U can reduce the access time by giving a better regex like batch* or *batch .

Use find instead

find /vol/ -name '*batch*' -print


cheers
  #5 (permalink)  
Old 06-28-2005
ANAMIKA56 ANAMIKA56 is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 7
grep commnad

It worked .
Thanks for the help guys.


Thanks.
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 07:48 PM.


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