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
Search for a word on9west Shell Programming and Scripting 2 04-23-2008 12:15 AM
Word search in awk videsh77 Shell Programming and Scripting 8 03-08-2007 07:40 PM
Search about word abu_hassan SUN Solaris 3 02-19-2007 09:17 AM
search for certain word in a files from directory legato UNIX for Dummies Questions & Answers 1 10-31-2006 02:35 AM
Is there any way to open vi on line or word ? umen UNIX for Dummies Questions & Answers 1 04-26-2006 07:25 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-02-2008
Registered User
 

Join Date: Jan 2008
Posts: 5
Thumbs up How can i open a directory and search a word using awk....

Hi guys,I m new one in awk scripting....i want to search a word with in a directory...in that directory haviing many files...if i give a work ,it should open the directory and open each file for to search that particular word....is it possible in awk...tell me guys its really urgent....
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 06-02-2008
Registered User
 

Join Date: Feb 2008
Posts: 3
Thumbs up

Hi ,

Doubt on u r Q ..?

1.U want the only list of the files which are WORD contains ..??
or
2.U want search the WORD and process using the awk ..??

For 1st :Try this
grep -l <word> <Dir_Path>/*.*

for 2nd :Try this => will print the line
awk '{ if ( $0 ~/<word>/ ) {print $0} }' <Dir_Path>/*.*


Try this let me know its working for u or not
happy learning .
thanks
Raj
Reply With Quote
  #3 (permalink)  
Old 06-02-2008
Registered User
 

Join Date: Jan 2008
Posts: 5
Thank raj....
can we give the directory path inside the program...not in comman line....i m writing a program in a file...then i m executing that file...so can u tell me that how can we give the directory path inside the program...i tried a lot....
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:31 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0