Jza Posted February 6, 2005 Report Share Posted February 6, 2005 I have a folder with lots of email files, I want to search for a specific string. I use less and I get the strings I wanted but I dunno which file is comming from. How can I manipulate the output so that the filename is display after the string. Something like this. > less * [file1]John has something good in the house.. [file8]standing the good work where I should Thanks. [moved from Software by spinynorman] Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted February 7, 2005 Report Share Posted February 7, 2005 grep -H good * | less Quote Link to comment Share on other sites More sharing options...
Jza Posted February 7, 2005 Author Report Share Posted February 7, 2005 grep -H good * | less <{POST_SNAPBACK}> Wow great stuff, thanks man, now I got a new challenge Imagine that I want to do this but from a higher level of folders. Actually I am triying to do this on the gaim logs. I had the conversation on ICQ son in Gaim I get just the ID number as the folder name which leaves me pretty lost. So I want to do the grepping from a list of folders and I want the path to be displayed instead of just the filename. Example: > ls 4323422 2343234 23454 3463334 3454345 375444 >> grep -H good * | less ..... [4323422/23-05-2004.log] the name of the good stuff.... [3454345/02-12-2004.log] only good man die... Quote Link to comment Share on other sites More sharing options...
ramfree17 Posted February 7, 2005 Report Share Posted February 7, 2005 maybe something to this effect: $ find . -exec grep good {} \; -print ciao! Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted February 8, 2005 Report Share Posted February 8, 2005 or grep -R -H good * | less Personally, I like 'more' grep -R -H good * | more Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.