On Tuesday, July 14, 2015 at 2:39:53 AM UTC+2, Rajesh Kumar TV wrote:
> I want to know how to remove special control characters from expect_out(buffer);
Hi Rajesh,
there is nothing like a pre-processing filter in Expect - i.e. you cannot modify the buffer _before_ the pattern matching. Depending on where the control characters come from, you have various options - here are the ones that came to my mind instantly:
* change the prompt of the spawned shell (if it is the prompt only)
* use command line options for the output format OR pipe the output through ansifilter[1]
* find a regular expression for "all escape sequences"[2] and use regsub (if removing them _after_ pattern matching is sufficient)
HTH,
Martin
[1]
http://andre-simon.de/doku/ansifilter/en/ansifilter.php
[2] Your examples include escape sequences [
http://ascii-table.com/ansi-escape-sequences.php], not just control charaters [0x00~0x1F].