On Tue, 28 Jan 1997 23:37:43 -0800 (PST), bodysurf(_at_)netcom(_dot_)com (Tim)
wrote:
[JEEP-L:341278] Sample Text Subject Line
Oops, I just posted another reply to this. Well, mine is better ;^)
# SED it for what you want.
NEWSUBJ=`echo $SUBJ | sed -e 's/^\[.*\]//'`
For the record, sed is doing greedy matching, which means that any
Subject containing another closing bracket will be mutilated up to and
including the +last+ bracket.
$ echo '[Jeep-L:31415926536] This is fun :-] (haw)' | sed -e 's/^\[.*\]//'
(haw)
You can use basically the same regular expression for sed as for
Procmail. This should do it:
$ echo '[Jeep-L:31415927] This is fun :-] (haw)' | sed -e 's/^\[[^]]*\] *//'
This is fun :-] (haw)
Note that this also trims any number of trailing spaces after the
closing bracket. Unlike my solution, this works well even for blank
Subjects.
Hope this helps,
/* era */
--
See <http://www.ling.helsinki.fi/~reriksso/> for mantra, disclaimer, etc.
* If you enjoy getting spam, I'd appreciate it if you'd register yourself
at the following URL: <http://www.ling.helsinki.fi/~reriksso/spam.html>