print HDLCGET "\#\!\/usr\/local\/bin\/expect\n"; print HDLCGET "set timeout -1\n"; open(MYINPUTFILE, "<", "hdlc2") or die "Open MYINPUTFILE failed: $!"; open(MYINPUTFILE1, "<", "hdlc3") or die "Open MYINPUTFILE1 failed: $!"; while() { my($line) = $_; chomp($line); #my($line1) = ; # This slurps the file - oops my $line1 = ; chomp($line1); print HDLCGET "spawn \ ssh $line\n"; print HDLCGET "expect \"assword: \"\n"; print HDLCGET "send \"$tacacspw\\r\"\n"; print HDLCGET "expect \"#\"\n"; print HDLCGET "send \"terminal length 0\\r\"\n"; print HDLCGET "expect \"#\"\n"; print HDLCGET "send \"show xconnect all | inc $line1\\r\"\nexpect \"#\"\n"; print HDLCGET "send \"exit\\r\"\n"; print HDLCGET "interact\n"; } close(MYINPUTFILE); close(MYINPUTFILE1);