Jump to content

Recursive read with Less


Recommended Posts

So I want to do a less on my email (mbox) I have my email distributed across several folders such as

accont#/
200#/  <-- being year
   04/   <-- Number of month
	29/   <-- Number of day
	 mail.mbs

 

 

So what I want is a recursive use of less so I can read all the email with out having to hop on each directory, is there anyway i can do this somehting like:

less -R * | grep <keyword>

 

Regards.

Link to comment
Share on other sites

I'm not exactly sure how you plan on reading all the emails you need to read just by searching for one keyword. Grep will just output the one line that contains the keyword unless you specifically tell it to show X number of lines before and/or after and how will you know how many lines you need?

 

If you want to read every file under the directory recursively, maybe you could do something like:

 

find ./ -name "*" -type f -exec sh -c 'less ${0}' {} \;

Edited by Steve Scrimpshire
Link to comment
Share on other sites

  • 4 weeks later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...