On Fri, 23 Mar 2001, Mark Leisher wrote:
> Oops. I missed a spot.
Isn't this mistake implying that you're still in favor of
'sed' over 'perl' for this kind of simple operation :-) ?
It seems to me a bit ironic that those who must be aware of all
sorts of sed/awk wizadry try to do everything they used to do with
'sed/awk/tr/uniq/join/sort/split/cut/....' with perl alone. For
some cases, perl appears to me too 'heavy'.
> % perl -ne 's/\[unicode\]// if (/^Subject:/); print;' messagefile
I would (and I believe you would as well) do
% sed '/^Subject: \[unicode\]/ s/ \[unicode\]//' messagefile
(Don't tell me to invoke perl with '-pe' option :-) )
Better still, I'd just put the following line in my ~/.procmailrc
:0 fw
*^TO_.*[EMAIL PROTECTED]
* ^Subject: [unicode]
| sed 's/\[unicode\]//'
:0 A
unicode
This recipe applies to anyone whose mail server is Unix-based and works
with procmail (and supports IMAP) regardless of how and on what platform
(MacOS, MS-Windows, Unix, ...) (s)he actually reads emails (as long as
the mail client/access method supports IMAP as well). Without the last
two lines (which automatically puts messages from Unicode mailing list
into a separate mail folder named 'unicode' on the IMAP server), the
requirement for IMAP could be dropped and POP3 clients would work as well.
Those who find this a bit cryptic may (or may not) wish to point their
browser at <http://www.procmail.org>.
Jungshik Shin