I use an e-mail quote attribution string like this:
On dd mmm yyyy hh:mm +hhmm, from firstname.lastname@example.org (Example Dot Org):
email@example.com is the sender's e-mail address and
Example Dot Org is the sender's real name.
When no real name is provided (or even sometimes when one is), the two are identical, and I end up with an attribution string like this:
On dd mmm yyyy hh:mm +hhmm, from firstname.lastname@example.org (email@example.com):
If (and only if) this is the case, I want to remove the
(firstname.lastname@example.org) part, leaving me with only:
On dd mmm yyyy hh:mm +hhmm, from email@example.com:
I already have a shell script which calls out to Perl to massage the e-mail before feeding it to my editor, and am thinking I could simply add some code to that to massage the attribution line as well. The solution could be done in Perl, awk, sed, or something else (though preferably not something too exotic).
I do know that the attribution line is the first non-blank line following the first blank line of the input, and I don't mind hardcoding against my preferred attribution line format. Simply deleting the part in paranthesises is trivial, but how to do it only when it is equal to what precedes it? Preferably without risking altering anything else in the email (text file).