Parsing text for IP Addresses
- From: dan63127@xxxxxxxxx
- Date: 16 Feb 2007 08:36:45 -0800
I am a complete newbie to TCL. I won't waste everyones time explaining
my end goal, becuase I think I'm stuck on just one small portion. I
can't seem to get the regexp right. Below is the text ouput that is
being parsed:
---file---
Target: 192.168.1.10:443
Status: unpaused
Weight: 1
Max. Connections: 0
Target: 192.168.1.99:443
Status: unpaused
Weight: 1
Max. Connections: 0
---end file---
What I need to do, is grab each of these two IP Addresses
(192.168.1.10 and 192.168.1.99) for a ping function used later in the
script.
Below is the code I've written around this:
while {$done != 1} {
expect {
-re "????????????" {
do_ping $expect_out(1,string)
}
timeout { set done 1 }
}
}
If anyone can suggest the right regexp to use, I would greatly
appreciate it. I've looked at a lot of previous posts, but I just
don't know enought about regexp to make heads or tails of most of it.
Thanks,
Dan
.
- Follow-Ups:
- Re: Parsing text for IP Addresses
- From: Glenn Jackman
- Re: Parsing text for IP Addresses
- Prev by Date: Re: file handling problem on windows with tcl8.4.14
- Next by Date: Re: Using Expect to Interact with a Curses Based Program
- Previous by thread: Using Expect to Interact with a Curses Based Program
- Next by thread: Re: Parsing text for IP Addresses
- Index(es):