Shell:Find a word in files in a directory and subdirectories | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Shell:Find a word in files in a directory and subdirectories

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 08-29-2008
yeclota yeclota is offline
Registered User
 
Join Date: Aug 2008
Last Activity: 5 May 2010, 3:18 AM EDT
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Shell:Find a word in files in a directory and subdirectories

I'm looking to write a ksh code with will be alble to find a word like 'toto' in all files going from my current directory.

eg.

/doc ----------->have: text.c which "toto"
/doc/usr-------->have: build.pc, help.java which "toto"
/doc/usr/cach -->have: test.sh which "toto"
/doc/build ------>Have Succes.ls which "toto"

Can you help me whith a code source?

Thanks
Sponsored Links
    #2  
Old 08-29-2008
manosubsulo manosubsulo is offline
Registered User
 
Join Date: Aug 2008
Last Activity: 25 November 2010, 3:36 AM EST
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
find . -exec grep -l 'toto' {} \;
Sponsored Links
    #3  
Old 08-29-2008
yeclota yeclota is offline
Registered User
 
Join Date: Aug 2008
Last Activity: 5 May 2010, 3:18 AM EDT
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
find . -exec grep -l 'toto' {} \

find . -exec grep -l 'toto'{}\;

return
find: 0652-018 An expression term lacks a required parameter.

can you give me some details because i'm not an expert in shell programming.

Thanks.
    #4  
Old 08-29-2008
manosubsulo manosubsulo is offline
Registered User
 
Join Date: Aug 2008
Last Activity: 25 November 2010, 3:36 AM EST
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
yeclota,

Dont use like this,

find . -exec grep -l 'toto'{}\;

Use like this.

find . -exec grep -l 'toto'<<spaces>>{}<<spaces>>\;
Sponsored Links
    #5  
Old 08-29-2008
yeclota yeclota is offline
Registered User
 
Join Date: Aug 2008
Last Activity: 5 May 2010, 3:18 AM EDT
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
It's Ok

It's Ok, Thanks for your help.

Lota
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Find files only in current directory...not subdirectories vsachan Shell Programming and Scripting 2 02-09-2012 12:43 PM
Find and replace a word in all the files (that contain the word) under a directory filter Shell Programming and Scripting 5 10-05-2011 12:22 AM
to parse a directory and its subdirectories and find owner name of files vyasa Shell Programming and Scripting 14 05-29-2009 05:43 AM
Find Files in a Directory Excluding Subdirectories Amol_Dicholkar UNIX for Dummies Questions & Answers 2 12-11-2008 06:54 AM
Find all files created by a specified user in a directory and its subdirectories abhilashnair UNIX for Dummies Questions & Answers 5 06-13-2007 02:37 AM



All times are GMT -4. The time now is 09:36 PM.