Can I expect some help here?

Steven W. Orr steveo at syslang.net
Wed Jul 5 22:03:01 EDT 2006


Or can I get some expect help? :-)

I need to find out how many lists Mike is subscribed to. Then I need get 
the names of the lists that Mike is subscribed to. I am successful at 
getting the number of lists. For the life of me I can't figure out how to 
get the names of the lists.

I can recognize anything I want in the input, but I can't get the second 
expect statement to work at all. Anyone know what I'm doing wrong? :-(

The code I'm using looks like this:

---------Start of code------------
#! /usr/bin/expect -f
expect -re "Subscribed to +\(\[0-9]+\) lists"
     puts "Got subd to: %%\n"
     puts [concat "-0--- $expect_out(0,string) ---\n"]
     puts [concat "-1--- $expect_out(1,string) ---\n"]
while { 1 } {
     puts "loop\n"
     expect {
 	-re "frambors:\$" {
 	    puts [concat "Got list>> $expect_out(buffer) <<\n"]
 	}
     }
}
puts "Interact\n"
interact
---------End of code------------



Here's my input:

-------------Start of input-------------------
show malieswski at hotmail.com

   Address: malieswski at hotmail.com
     Address is valid.
       Address Mailbox: malieswski at hotmail.com
     Registered as            Mike X <mx at hotmail.com>
     Registered on            Fri Aug 29 10:04:45 2003
     Data last changed on     Mon Sep 19 11:22:17 2005
     Subscribed to            2 lists

       frambors:
         Subscribed as   Mike X <mx at hotmail.com>
         Subscribed on   Fri Aug 29 10:04:45 2003
         Last changed on Tue May 25 17:41:30 2004
         Receiving       each unduplicated message
         Subscriber flags:
           noeliminatecc
           nohide
           nohidepost
           nopostblock
           prefix
           replyto
           selfcopy
           norewritefrom
           noackstall
           noackdeny
           noackpost
           noackreject

       framcom:
         Subscribed as   Michael X <mx at hotmail.com>
         Subscribed on   Mon Sep 19 11:22:17 2005
         Last changed on Mon Sep 19 11:22:17 2005
         Receiving       each unduplicated message
         Subscriber flags:
           noeliminatecc
           nohide
           nohidepost
           nopostblock
           prefix
           replyto
           selfcopy
           norewritefrom
           noackstall
           noackdeny
           noackpost
           noackreject


Majordomo>
-------------End of input-------------------

The output is this:

---------------------START of output-------------------
   Address: malieswski at hotmail.com
     Address is valid.
       Address Mailbox: malieswski at hotmail.com
     Registered as            Mike Malieswski <malieswski at hotmail.com>
     Registered on            Fri Aug 29 10:04:45 2003
     Data last changed on     Mon Sep 19 11:22:17 2005
     Subscribed to            2 lists
Got subd to: %%

-0--- Subscribed to            2 lists ---
-1--- 2 ---
loop


       frambors:
         Subscribed as   Mike Malieswski <malieswski at hotmail.com>
         Subscribed on   Fri Aug 29 10:04:45 2003
         Last changed on Tue May 25 17:41:30 2004
         Receiving       each unduplicated message
         Subscriber flags:
           noeliminatecc
           nohide
           nohidepost
           nopostblock
           prefix
           replyto
           selfcopy
           norewritefrom
           noackstall
           noackdeny
           noackpost
           noackreject

       framcom:
         Subscribed as   Michael Malieswski <malieswski at hotmail.com>
         Subscribed on   Mon Sep 19 11:22:17 2005
         Last changed on Mon Sep 19 11:22:17 2005
         Receiving       each unduplicated message
         Subscriber flags:
           noeliminatecc
           nohide
           nohidepost
           nopostblock
           prefix
           replyto
           selfcopy
           norewritefrom
           noackstall
           noackdeny
           noackpost
           noackreject


Majordomo>loop
---------------------END of output-------------------

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net



More information about the gnhlug-discuss mailing list