This helped out considerably! I found that there are 3 CR's at the beginning of each line.. stripping these out makes it all work perfectly :)
Thanks,
On Wed, 2003-01-08 at 10:44, Christopher Kruslicky wrote:
> On Wednesday 08 January 2003 3:11 pm, Jason Frisvold wrote:
> > This works great :)
> >
> > Still curious what's in that line, but ...
> >
> > Is there a way to show the raw output?
> >
>
>
> a very good and useful idea :) it's a regex that matches from ' ' thru '~',
> which according to the ascii chart are the first and last printable
> characters:
>
> | 00 nul| 01 soh| 02 stx| 03 etx| 04 eot| 05 enq| 06 ack| 07 bel|
> | 08 bs | 09 ht | 0a nl | 0b vt | 0c np | 0d cr | 0e so | 0f si |
> | 10 dle| 11 dc1| 12 dc2| 13 dc3| 14 dc4| 15 nak| 16 syn| 17 etb|
> | 18 can| 19 em | 1a sub| 1b esc| 1c fs | 1d gs | 1e rs | 1f us |
> | 20 sp | 21 ! | 22 " | 23 # | 24 $ | 25 % | 26 & | 27 ' |
> | 28 ( | 29 ) | 2a * | 2b + | 2c , | 2d - | 2e . | 2f / |
> | 30 0 | 31 1 | 32 2 | 33 3 | 34 4 | 35 5 | 36 6 | 37 7 |
> | 38 8 | 39 9 | 3a : | 3b ; | 3c < | 3d = | 3e > | 3f ? |
> | 40 @ | 41 A | 42 B | 43 C | 44 D | 45 E | 46 F | 47 G |
> | 48 H | 49 I | 4a J | 4b K | 4c L | 4d M | 4e N | 4f O |
> | 50 P | 51 Q | 52 R | 53 S | 54 T | 55 U | 56 V | 57 W |
> | 58 X | 59 Y | 5a Z | 5b [ | 5c \ | 5d ] | 5e ^ | 5f _ |
> | 60 ` | 61 a | 62 b | 63 c | 64 d | 65 e | 66 f | 67 g |
> | 68 h | 69 i | 6a j | 6b k | 6c l | 6d m | 6e n | 6f o |
> | 70 p | 71 q | 72 r | 73 s | 74 t | 75 u | 76 v | 77 w |
> | 78 x | 79 y | 7a z | 7b { | 7c | | 7d } | 7e ~ | 7f del|
>
>
> to show raw output, compare these:
> $ perl -e '$tmp=sprintf "%s", "123"; print "...$tmp...\n";'
> ...123...
> $ perl -e '$tmp=sprintf "%vx", "123"; print "...$tmp...\n";'
> ...31.32.33...
>
> in %vd, 'v' is perl-specific, in this case outputting the ascii value of
> each character in the string. Note the values are in hex to match the
> ascii chart above.
>
>
>
> > On Wed, 2003-01-08 at 14:52, John W. Krahn wrote:
> > > Jason Frisvold wrote:
> > > > Hi all,
> > >
> > > Hello,
> > >
> > > > I'm using the Net::Telnet module to automate some of the more
> > > > menial tasks I have to deal with every so often. Part of the task
> > > > requires parsing a stream of data from the device I'm telnetting to
> > > > (A Marconi ASX-200 to be exact) ... I've successfully set up the
> > > > telnet, logged in, and executed the proper commands. Now, however, I
> > > > need to retrieve data from the device. I can submit the command and
> > > > use getline() to retrieve lines, one at a time, and parse it.
> > > > However, there are "hidden" characters here and I don't know how to
> > > > determine what they are.
> > > >
> > > > Here is a quick snippet of the code :
> > > >
> > > > $Telnet->print("sec log sho");
> > > > while (my $line = $Telnet->getline(Timeout => 5,)) {
> > > > chomp $line;
> > >
> > > Instead of chomp (because this will remove newlines as well) use this:
> > >
> > > # remove every character NOT in the range ' ' to '~' inclusive
> > > $line =~ s/[^ -~]+//g;
> > >
> > > > print "--->>>>$line<<<<---\n";
> > > > }
> > >
> > > John
> > > --
> > > use Perl;
> > > program
> > > fulfillment
--
---------------------------
Jason H. Frisvold
Backbone Engineer
Penteledata Engineering
[EMAIL PROTECTED]
RedHat Certified - RHCE # 807302349405893
---------------------------
"Something mysterious is formed, born in the silent void. Waiting alone
and unmoving, it is at once still and yet in constant motion. It is the
source of all programs. I do not know its name, so I will call it the
Tao of Programming."
signature.asc
Description: This is a digitally signed message part
