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

Re: Auto-complete address when sending email



This has moved into mutt-users land, by I like it here. :)

On Wed, Jan 19, 2011 at 16:45:40 +0100, Luca Matteis wrote:
>     grep $1 
> ~/.mutt/cache/bodies/imap\:lmatteis\@imap.bioversity.cgiar.org/INBOX/* | awk 
> -F \< '{print $2}' | awk 'NF != 0 {print}' | awk -F \> '{print $1}' |awk 'NF 
> != 0 {print}'

Cool that you got it to work on your cache.
Without even having tried, my mini-review says that such a combination
of grep and awk calls for a single awk script (I prefer Perl myself).

And it seems to rely on the "<user@domain>" address syntax, but I have
hardly seen anything else recently. :)

Oh, and having tried it, it stumbles over HTML in the bodies.

Here's my try:
perl -pe "while (<>) { if (m|<([^\>]*$1[^\>]*)>|) { print \"\$1\\n\"; }; }" 
~/.mutt/cache/bodies/imap\:lmatteis\@imap.bioversity.cgiar.org/INBOX/*

(In words: match your search term within '<' and '>', and print all the
stuff within.)

And the funny quoting/escaping is just to pass the shell's $1 into Perl.
A pure Perl script is easier.

Moritz :)