I have a file consisting of a list of ip address, one per line, a seedfile if you will.
I have a file name <ip address>.push for each ip address contained in the seedfile
I want to be able to open and read the seedfile assigning the ip to a variable, then open the associated <ip address>.push file and send each line one by one.
this is what I got so far ..
#! /usr/local/bin/expect --
puts "[exec clear]"
# Open Seedfile
#=============================================================
set ifil [open "sss" r]
#
# Main Body. While reading the seedfile, Assign current ip to a variable, use that variable assignment to open the assoicated push file.
#=============================================================
while { [gets $ifil host] >=0 } {
puts "$host\n"
set pfil [open '$host.push' r] THIS IS ACTUALLY THE PROBLEM
#set pfil [open "$host.push" r]
puts "$pfil\n"
}
---------- Post updated at 11:49 AM ---------- Previous update was at 11:16 AM ----------
ok got a little further ...
set ifil [open "listofips" r]
while { [gets $ifil host] >=0 } {
puts "$host\n"
#set f [open $host.push]
set f [open static.push] I want to use the $host var in the filename.
while {[gets $f line] >= 0} {
puts $line
}
close $f
}
close $ifil