[Discuss] Please help with a sed script

Bill Horne malassimilation at gmail.com
Tue May 25 02:21:53 EDT 2021


Thanks for reading this: I appreciate your time.

I'm the Moderator of The Telecom Digest, which is the oldest e-zine on 
the Internet.

The readers send in pointers to articles of interest, and each day, 
other readers whom subscribe with the "digest" option receive an email 
with all the previous day's stories.

Here's the table-of-contents from a typical day:

    * 1 - [telecom] Can robocalls be tracked? - "bob prohaska"
    <bp at remove-this.www.zefox.net>
    * 2 - Re: [telecom] Can robocalls be tracked? - Bill Horne
       <malQRMassimilation at gmail.com>
    * 3 - [telecom] Verizon Media debuts ad-targeting solution without
    identifiers
       - Moderator <telecomdigestsubmissions at remove-this.telecom-digest.org>

And here's what I'd like to change it to, using (if possible) sed:

        (tr)(td)Can robocalls be tracked?(/td)(/tr)
        (tr)(td)Re: Can robocalls be tracked?(/td)(/tr)
        (tr)(td)Verizon Media debuts ad-targeting solution without
        identifiers(/td)(/tr)

        ("less-than" and "greater-than" symbols have been changed to
        parens here for obvious reasons.)

Things to note:

 1. The Subjects lines vary in length, and may contain hyphens.
 2. The name and email of the contributor is also published with the
    actual post, further on in each digest, so it doesn't have to appear
    in the Table of Contents.
 3. The "m" option of sed, which the manual says will do a multi-line
    "s" command, doesn't appear to work on the OS I'm using, which is
    Ubuntu 16 LTS.

Up until now, I've been doing this change every day, with emacs macros 
and the rest by-hand. I want to automate a lot more of the daily work, 
so I'm hoping that there's a way to get Linux sed to do that. I don't 
need sed per se: if awk or some other utility would be a better choice, 
please tell me about that possible solution instead.

Thanks you again.

Bill

-- 
Bill Horne



More information about the Discuss mailing list