From: BLACKSTONE, J. D. <jda...@ci...> - 2003-04-08 20:01:16
|
> -----Original Message----- > From: John Mahoney [mailto:ex...@h0...] > Sent: Tuesday, April 08, 2003 2:03 PM > To: db...@CT...; > exp...@li...; > exp...@li... > Subject: Re: [Expectperl-discuss] parsing non-ascii char's > > > Thx for your suggestion and I can see some merit here. > I am, however, starting to think I am off topic for this > list. > > My real problem is that I do not have multiple lines of > data to parse. It's all one long line with lots of > control chars. > > When I print the data to a file > cat <filename> > shows output that looks just like my telnet session. > cat -v <filename> > shows all the ugly special chars > wc -l <filename> > shows I have one line of data and > cat <filename> | wc -l > still tells me I have one line of data. > > I think I have to teach the script to break this output > into separate lines. > > Maybe this is an IO::Stty puzzle or something. I'm suspecting all you need is some training with regular expressions. Start with the Llama book, the Camel book, or the Perl regular expressions tutorial (http://www.perldoc.com/perl5.8.0/pod/perlretut.html) or quick start (http://www.perldoc.com/perl5.8.0/pod/perlrequick.html). You should be able to keep that one line and break it up into separate strings (try the split function) or use it over and over again with multiple operations. By and large, the presence of control characters and/or 8-bit characters shouldn't interfere with this, but if you need to represent a control character in a string or expression you can do so with for example "\cX" to represent control-X. jdb |