<<< Date Index >>>     <<< Thread Index >>>

Re: creating an alias of a group email?



Hi Marianne!

On Sat, 13 Sep 2008, Marianne Promberger wrote:

> The macro would pipe the message to formail, which would extract the
> To: headers, then pipe that through sed or awk  to give a meaningful
> mutt alias line and append that to your mutt aliases file. Possibly the
> macro could as a last step open your mutt aliases file in an editor,
> so that you could make finegrained corrections if necessary. 

This could work (untested):

,----[ ~$ cat mutt_alias.sh ]-
| #!/bin/bash --
| 
| # mutt alias file
| ALIAS="$HOME/.mutt/alias_gen"
| 
| # contains the message in a variable
| STDIN="`cat`"
| 
| TO=`echo "${STDIN}"|formail -tzx "To:"|tr -d "\n" |sed 's/.*<//;s/>//'`
| 
| # Record the date
| DATE=`date +%d.%m.%Y`
| 
| echo "Name of alias:" 
| read name </dev/tty
| 
| cat >>"$ALIAS" <<EOF
| # alias added "$DATE"
| alias "$name"  $TO
| EOF
`----

Then simply pipe your message through that shell script.

regards,
Christian
-- 
rain falls where clouds come
sun shines where clouds go
clouds just come and go
                -- Florian Gutzwiller