Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Anyone know of an egrep command which will show the authors and subjects of all mails contained in some directory?

share|improve this question

Maybe something like:

egrep '^(From|Subject):' *

This will match From: or Subject: at the beginning of a line, which is approximately what you want.

share|improve this answer
That looks good, but how will that show From and Subject? – user15770 Feb 21 '12 at 12:42
That's exactly what it does. Have you tried it? – larsks Feb 21 '12 at 12:46
Does the star at the end act as a kleene star? – user15770 Feb 21 '12 at 12:48
No. For the behavior of the star at the end, see the bash(1) man page. Note that the star is not part of the regular expression. – larsks Feb 21 '12 at 14:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.