Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help on "ls -l $* ¦ awk '{ print $9}'+ grep $9 pattern>> result"

Status
Not open for further replies.

narenpalepu

Vendor
Nov 18, 2002
1
US
Hi All

I am a starting with awk I like to grep for a pattern from all the files in directory and save the result to a file with file name. please help me out.
My seudo script
"ls -l $* | awk '{ print $9}'+ grep $9 pattern >> result"

Thanks

Naren
 
You can use AWK to do the regular expression match without needing to subsequently grep - e.g. ...

ls -l * | awk '/regexp/ print $9'
or grepping a specific field ..
ls -l * | awk '$n =~ /regexp/ print $9'

sorry it's been a while but I think syntax is correct
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top