Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This is the text file i have. if it contains alphabets,perl should create a file name else it should login to the device with the given ip address in the file.network1 12.435.23.12 12.45.34.23 network2 32.334.23.23 54.56.563.32
can anyone give suggestions on this ?#/usr/bin/perl use Net::Telnet; use Net::Telnet::Cisco; #Opening a input text file for logging into devices open inFile, '<', 'ip.txt' or die "MESSAGE From SAT : Couldn't open ip +ut.txt for reading verify the correct path : $!"; print " hello \n\n "; #storing the contents of the input file to a variable print " Reading the file . . .\n\n"; while (! eof inFile) { $line .= ' ' . <inFile>; chomp $line; print $line,"\n\n"; if ($line=/.*?\w/) { $accountname = $1; print "Account name =", $accountname; open ("$accountname"), or die "Could not create the account name.txt.\ +n"; ................ . . } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: text parsing
by shmem (Chancellor) on Jul 07, 2006 at 08:29 UTC | |
|
Re: text parsing
by Moron (Curate) on Jul 07, 2006 at 11:04 UTC | |
by Anonymous Monk on Jul 10, 2006 at 05:00 UTC | |
by Moron (Curate) on Jul 10, 2006 at 10:07 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |