Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linux Questions



>>>>> "Craig" == C Oda <craig@example.com> writes:

    Craig> On Fri, 2 Aug 1996, Stephen J. Turnbull wrote: 
    >> I will shortly have a procmail script that strips the TWICS ad,
    >> and I'll publish that when I've written it.  :-) Nothing
    >> against TWICS, but I don't need to see

    Craig> Actually, this is a good thing to have.  The digests get an
    Craig> annoying amount of these advertisements.  I want to strip
    Craig> all of them out except for one at the end.

Well, for you procmail users, here it is, and not too complicated:

:0 f
* ^TOtlug
| sed -e '/^a word from the sponsor will appear below$/,$ d'

If you want to get rid of material preceding the identifying line
(such as the line of dashes in the TWICS ad) you could use a perl or
maybe awk script instead (as far as I know it's hard to make sed
understand the concept of embedded newlines in patterns).  Or you
could use a recipe like

:0 f
* ^TOtlug
| sed -e '/^-------/,/Fax: 03-3353-6096$/ d'

since the content is identical every time.  However, this is very
risky since many mailers use a line of dashes to separate attachments, 
as do some users.

I suggest using the begin-line (^) and end-line ($) magic characters
for two reasons.  First, many people include the whole message or fail
to remove the .sigs and then type *after* the included message.
You'll lose all content in that case.  Second, "a word from the
sponsor" just might appear in a message, but it's unlikely to appear
exactly on one line that way.

I use the 

:0 c
.backup

:0 ic
| cd .backup && rm -f dummy `ls -t msg.*|sed -e 1,50d`

recipes to prevent complete lossage in that case anyway.

-- 
                           Stephen John Turnbull
University of Tsukuba                                        Yaseppochi-Gumi
Institute of Policy and Planning Sciences  http://turnbull.sk.tsukuba.ac.jp/
Tennodai 1-1-1, Tsukuba, 305 JAPAN                 turnbull@example.com
-----------------------------------------------------------------
a word from the sponsor will appear below
-----------------------------------------------------------------
The TLUG mailing list is proudly sponsored by TWICS - Japan's First
Public-Access Internet System.  Now offering 20,000 yen/year flat
rate Internet access with no time charges.  Full line of corporate
Internet and intranet products are available.   info@example.com
Tel: 03-3351-5977   Fax: 03-3353-6096


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links