ddrew78 has asked for the wisdom of the Perl Monks concerning the following question:
Another idea I was considering was to just leave everytihng in the original file (hdlc) and then write the script so it uses field one of "$line" for the first input and field two for the second, but I have yet to figure out how to get that to work as well.system 'cat temp3 | grep "hdlcppp" > hdlc1'; system "mv hdlc1 hdlc"; system 'cat hdlc | cut -d " " -f2-3 > hdlc1'; system "mv hdlc1 hdlc"; system 'cat hdlc | cut -d " " -f1 > hdlc1'; system 'cat hdlc | cut -d " " -f2 > hdlc2'; system "rm hdlcget"; open(HDCLGET, ">hdlcget"); print HDLCGET "\#\!\/usr\/local\/bin\/expect\n"; print HDLCGET "set timeout -1\n"; open(MYINPUTFILE, "hdlc1"); while(<MYINPUTFILE>) { my($line) = $_; chomp($line); print HDLCGET "spawn \ ssh $line\n"; print HDLCGET "expect \"assword: \"\n"; print HDLCGET "send \"password\\r\"\n"; print HDLCGET "expect \"#\"\n"; print HDLCGET "send \"terminal length 0\\r\"\n"; print HDLCGET "expect \"#\"\n"; open(MYINPUTFILE1, "hdlc2"); while(<MYINPUTFILE1>) { my($line1) = $_; chomp($line1); print HDLCGET "show xconnect all | inc $line1\\r\"\nexpect \"# +\"\n"; } } print HDLCGET "send \"exit\\r\"\n"; print HDLCGET "interact\n"; system "touch hdlcget"; system "chmod 777 hdlcget"; system "hdlcget >hdlc3";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using multiple input files
by toolic (Bishop) on Mar 27, 2009 at 16:16 UTC | |
|
Re: using multiple input files
by dHarry (Abbot) on Mar 27, 2009 at 16:09 UTC | |
by ddrew78 (Beadle) on Mar 31, 2009 at 15:53 UTC |