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
How to negate grep result? mmdawg Shell Programming and Scripting 4 05-05-2008 05:24 AM
diaplaying the grep result rag84dec Shell Programming and Scripting 1 03-26-2008 11:37 PM
grep exclude/find single and double quotes Lindy_so UNIX for Dummies Questions & Answers 4 03-06-2008 06:01 AM
grep to handle a 0 result ocelot UNIX for Dummies Questions & Answers 6 02-05-2007 08:19 AM
To have a numeric result from grep Hak Dee UNIX for Dummies Questions & Answers 2 08-07-2006 04:26 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-06-2008
Registered User
 

Join Date: Feb 2008
Posts: 15
Elimincating double result when using find and grep

Hi,

i am using the command

Code:
find . -exec grep -i  "sometexttofoundinfiles" '{}' \; -print
The problem with this command is it prints the path of file i want twice. I did try the "-q" option of the grep command. It generates an error "invalid option". i guess the shell i am using must be an older version or i am just not sure. is there any way, i can print the file path only once?
Reply With Quote
Forum Sponsor
  #2  
Old 02-06-2008
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,699
Quote:
Originally Posted by silas.john View Post
Hi,

i am using the command

Code:
find . -exec grep -i  "sometexttofoundinfiles" '{}' \; -print
The problem with this command is it prints the path of file i want twice. I did try the "-q" option of the grep command. It generates an error "invalid option". i guess the shell i am using must be an older version or i am just not sure. is there any way, i can print the file path only once?
Drop the -print.
Code:
find . -exec grep -i  "sometexttofoundinfiles" '{}' \;
Or

Code:
find . -exec grep -q -i  "sometexttofoundinfiles" '{}' \; -print
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:43 AM.


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 Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0