[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Send equal reply to messages in mailbox folder



On 12-08-2004, at 13h 04'53", Jacob Friis Larsen wrote about "Re: Send equal reply to messages in mailbox folder"
> >Try to run the 
> >grep '^From ' mailbox | awk '{print $2}' | sort | uniq
> 
> If I do:
> grep '^Return-Path: ' mailbox | awk '{print $2}' | sort | uniq
> 
> I get E-Mail adressess like this:
> <address1>
> <address2>
> ...
> 
> How can I remove the "<" and ">"?

grep '^Return-Path: ' mailbox | awk '{print $2}' | sort | uniq | sed 's/<//' | sed 's/>//'

But you will miss few messages. Do this to check:

grep -c '^From ' mailbox
grep -c '^Return-Path: ' mailbox

The first one will tell you how many messages you have, and the second
how many of them contains the Return-Path: header.

Are there so many that you can't just do it one a the time?
Use the for loop and instead of the `expression` copy and paste the
addresses. I would do that if it is no more than few tens of messages.

> Would it be possible to also get the subject?

Of course, but not in the same go with this rudimentar script :-)

You could do grep -e '^Return-Path: ' -e '^Subject: ' mailbox
but then you can't do the for loop, since the addresses and the
subject is one after eachother...

You will need to use perl or something, which I don't know. For me it
will be easier to write a small program in fortran just to recover (if
any) the headers: From, From:, Subject:, etc. 
> 
> $ echo $SHELL
> /bin/bash
> 
> Thanks for your help :)
> Jacob


You are welcome.

Ionel


P.S. You may ask your question on a mail program list, such as
mutt-users@mutt.org.



Reply to: