The UNIX and Linux Forums  

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



Thread: Grep Problem
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 06-22-2005
vino's Avatar
vino vino is offline
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,643
Quote:
Originally Posted by Simerian
find has a command option that allows you to run, for instance, a grep against each file it locates. This is sometimes very useful... You'll have to check the man page for the syntax.
Here is your answer

Code:
find . -name 'haystack' -exec grep 'needle' {} \; -print
The -print will display the corresponding haystack for each successful needle found.

Vino
Reply With Quote