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 > 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
Search / Find / grep command ... videsh77 UNIX for Dummies Questions & Answers 4 02-22-2007 09:38 AM
Search files that all contain 4 specific words WoodenSword Shell Programming and Scripting 13 01-22-2007 06:57 AM
find words with grep.... chrisxgr Shell Programming and Scripting 8 04-07-2006 01:25 AM
Search and replace words between two keywords vrrajeeb Shell Programming and Scripting 6 05-11-2005 12:15 PM
search for words in file Agent_Orange Shell Programming and Scripting 4 10-25-2002 05:29 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 Rate Thread Display Modes
  #1 (permalink)  
Old 12-12-2006
akhil313 akhil313 is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 1
Smile grep with find to search for matchiing words

Hi all,
Please help me in the following dbt

i want to know the different files in the current and the sub directory which have some search key in that . for example

i want to know all filenames followed by the word 'unix' in all files.

the file name and the matching word have to be displayed.

i tried with the following command

find . -exec grep "aki" '{}' \;

but the file name was not listing

Please also help me in knowing the significance of " " and {} \ in the above command
  #2 (permalink)  
Old 12-12-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,748
Code:
find . -exec grep -l 'aki' {} \;
the backslash forces the shell to treat the semicolon as a literal, otherwise the shell discards it. the -exec option has to have and "end" which is defined by the ; character
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 04:22 AM.


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