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 > Operating Systems > AIX
.
google unix.com



AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
can anyone help with shell script command about searching word with grep command? aintour Shell Programming and Scripting 2 10-14-2009 05:51 PM
How to feed the output from grep command to paste command ks_reddy Shell Programming and Scripting 2 04-04-2009 04:47 AM
grep command cool09ubuntu UNIX for Dummies Questions & Answers 2 02-03-2009 04:31 PM
how to exclude the GREP command from GREP yamsin789 UNIX for Advanced & Expert Users 2 10-05-2007 03:59 AM
grep command avadhani Shell Programming and Scripting 2 06-06-2005 09:26 AM

Reply
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 Rate Thread Display Modes
  #1 (permalink)  
Old 4 Weeks Ago
bbbngowc bbbngowc is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 196
Help with Grep command

Hi,

I'm trying to search across a bunch of files for certain pattern. I want the output to only be a list of files that contain the pattern.

I do:

Code:
find . -type f -name "*.ACT" -exec grep pattern {} \;
And it comes with the the filename and the line in the file that contains the pattern, etc etc. How can I get this to show me only the files?
  #2 (permalink)  
Old 4 Weeks Ago
cero cero is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 56
Hi,
The manpage points you to the -l and -r flag:
Code:
grep -lr pattern *.ACT
lists only filenames and does the directory recursion, so find is not needed.
  #3 (permalink)  
Old 4 Weeks Ago
bbbngowc bbbngowc is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 196
Thanks. That's much simpler that what I used.

Code:
find . -type f -name "*.ACT" -print | xargs grep -il pattern
Reply

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




All times are GMT -4. The time now is 01:51 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