On 21:55 06 Mar 2002, Vidiot <[EMAIL PROTECTED]> wrote:
| >On 20:26 06 Mar 2002, Vidiot <[EMAIL PROTECTED]> wrote:
| >| >Hey everyone, I am trying to make a "FROM" script that basically shows =
| >| >the person running the script who the mail is from that they have.
| >|
| >| How about:
| >|    sed -e '/^From /b' -e d
| >| The only legal from at the beginning is "From "
| >
| >Too verbose:
| >     sed 1q
| >works fine since "From " is the first line.
| 
| Doesn't that work with only 1 piece of mail in the mailbox?  Most mail boxes
| have more than one piece of mail.

I read his request to be per-mail item. (Eg for announcement on mail arrival.)
Besides, _my_ mail is stored one message per file :-)

But sure, for a standard UNIX mail box one might want this:

        sed -n '/^From /p'
    or
        sed '/^From /d'

| >However, that's the envelope. May well _not_ be the author after passing through a 
|mailing
| >list or gateway. If you want the "From:" line:
| >     sed -n '/^[Ff][Rr][Oo][Mm]:/p'
| >will do the trick.
| 
| That is true.  But you might want to know that it is from a mail list AND
| who the original sender is.

Generally "From " has been comparatively irrelevant in my experience
except for forensic purposes, and even then I tend to want Received: etc.
Once you start wanting that level of detail he might want any header...

| Then you might want:
|       sed -e '/^From[: ]/p'
| That will print both lines.  Looking for anything other than "From" is
| a waste, because by definition the case is only as shown.

This is actually false. For the envelope ("From ") it's true, but for
the mail headers (the envelope's not part of the headers) the header name
is case insensitive. Have a look at RFC2822 - an enlightening document.

Cheers,
-- 
Cameron Simpson, DoD#743        [EMAIL PROTECTED]    http://www.zip.com.au/~cs/

The impossible we understand right away - the obvious takes a little longer.



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to