Print

Print


Sara Amato wrote:

> Are you using the log for anything?  You can simply not log and not
> worry about all the extra characters, and have Expect look for regular
> values you see on the screen.  E.g.
>
>
> send "03"
> expect "LOCATION"
> send "="
> expect "LOCATION ="
> send -h "ares\r"
>
> We are using Expect & perl to create  new materials lists off of our III
> system and output to the web - see
> http://library.bowdoin.edu/cataloging/new/
>
> Would be happy to share scripts, with the caveat that I'm NOT a
> programmer, and there are most likely more elegant ways to do things
> than I have!
>
> Kenneth R. Irwin wrote:
>
>> Hi folks,
>>
>> I just started tinkering with Expect to talk to our OPAC, and I'm finding
>> that when I look at the resulting log files I get a lot of garbage
>> characters eg:
>> [H[2J[1;11H*** INNOPAC
>> (for more see log: http://www6.wittenberg.edu/lib/logfile.txt )

After taking a quick look at the codes, I am guessing that this regexp
should remove all of the ANSI escape codes from your data:

s/\033\[.*?[a-z]//ig;

It looks like the codes start with ESC[ followed optionally by some
numbers and/or punctuation, and are terminated by a single letter.

--
William Wueppelmann
Electronic Systems Specialist
Canadian Institute for Historical Microreproductions (CIHM)
http://www.canadiana.org/