mizmaster22 has asked for the wisdom of the Perl Monks concerning the following question:
EDIT: Here are the first lines from my text file,the word data indicates the information I want and as you can see it is wrapped in the characters that I want to remove:
data data dat data data[1;1H[24;0H[K7[1;1H[0;7mdata data data da +ta data[0m8[23;0H[0;7m + [0m[23;0H[2;1H[K[B[K[B[K[B +[K[B[K[B[K[B[K[B[K[B[K[B[K[B[K[B[K[B[K[B[K[B[K +[B[K[B[K[B[K[B[K[B[K[B[K[B7[1;65H[0;7m Page 1 +[0m8[3;1H[3;23 [5;1Hdata data [5;47Hdata: data data data data, +data [6;9Hdata: data [7;4Hdata data data data [7;49Hdata data data data
HERE IS MY SCRIPT:(Which is working perfectly)
my ($hostname, $line, $password, $pop, $username); $hostname = "local_host"; $username = "name"; $password = "pass"; $file = "log_file"; $file1 = "dump_log"; use Net::Telnet (); $pop = new Net::Telnet (Telnetmode => 1, Input_log => $file, dump_log +=> $file1); $pop->open(Host => $hostname,Port => port#); $pop->waitfor('/login: $/i'); $pop->print($username); $pop->waitfor('/password: $/i'); $pop->print($password); $pop->print("terminal type"); $pop->waitfor('/Command: $/i'); $pop->print("terminal_command"); $line = $pop->get; print $line; open FILE, "data.txt" or die $!; print FILE $line; close FILE;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to parse out unwanted characters in a text file using Perl
by ikegami (Patriarch) on Jun 10, 2011 at 18:36 UTC | |
|
Re: How to parse out unwanted characters in a text file using Perl
by Not_a_Number (Prior) on Jun 10, 2011 at 19:26 UTC | |
|
Re: How to parse out unwanted characters in a text file using Perl
by ikegami (Patriarch) on Jun 10, 2011 at 19:47 UTC | |
by mizmaster22 (Novice) on Jun 10, 2011 at 20:24 UTC | |
by ikegami (Patriarch) on Jun 10, 2011 at 23:18 UTC |