LSTOWN-L Archives

LISTSERV List Owners' Forum

LSTOWN-L

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Stan Ryckman <[log in to unmask]>
Mon, 31 Mar 1997 11:01:38 -0500
text/plain (90 lines)
At 10:36 PM 3/30/97 +0000, Adam Lasnik wrote:

>THE PROBLEM:
>I tried to just add the string "set listname topics:+name for " to the
>e-mail addresses, but Listserv choked... because so many of the addresses
>had more than just [log in to unmask] :-(
>i.e... "Jim Smith" <[log in to unmask]> and
>jsmith ([log in to unmask]) and so on :-(
>
>WHAT I HUMBLY ASK FROM YOU SMART FOLKS OUT THERE:
>Can anyone suggest:
>-- a utility
>-- a Perl string
>-- a tecnique in Microsoft Word or Win95 Write
>...to enable me to extract from this list (and future lists) just
>   [log in to unmask]
>
>Thanks very much in advance for your help :-)

I'm a little unclear as to what format(s) your name list might contain.
The following awk script will handle the cases you listed (and will
also handle the output from a QUERY or REVIEW command, skipping
lines that contain no "@").

Put it in a file called "getaddr.awk".

You can change the line that says:
        print addr
to
        print "quiet set listname option for", addr
if you want to build a file of commands, for example.  If there are
other conditions than I've dealt with -- ending in comma, or enclosed
in <> or () -- the extension should be pretty obvious.

It leaves "weird but legal" cases such as
        "I @m th3 gr8t3st" <[log in to unmask]>
for hand processing.

Note: since you mentioned perl, I'm assuming you have access to awk.
There are PC versions of both; I used MKS Toolkit's to test this.
In a pinch, you can always take your list and the script to a UNIX
system and run it there (every UNIX will have awk).

Hope this helps,
Stan
========== cut here ==========
# print "plain old" email addresses
# getaddr.awk - S. Ryckman - 31 March 1997
#
# invocation:
#       awk -f getaddr.awk inputfile > outputfile
#
# warning:  only lightly tested

# any line with two "@" is a problem:
[log in to unmask]*@/ {
        print "DO THIS BY HAND:", $0
        next
        }
# one "@"
/@/ {
        # find word containing the "@"
        for(k=1;k<=NF;k++)
                if(index($k,"@")>0)
                        break;
        addr = $k

        # if it ends in a comma, get rid of it:
        if(substr(addr,length(addr),1)==",")
                addr=substr(addr,1,length(addr)-1)

        # if it's in <>, dump those:
        if(substr(addr,1,1)=="<"  && \
                        substr(addr,length(addr),1)==">")
                addr=substr(addr,2,length(addr)-2)

        # if it's in (), dump those:
        if(substr(addr,1,1)=="("  && \
                        substr(addr,length(addr),1)==")")
                addr=substr(addr,2,length(addr)-2)

        print addr
        next
        }
# if lines without "@" need processing, put it before the "next"
# else you can omit the following:
{
        next
        }

ATOM RSS1 RSS2