sexpect icon indicating copy to clipboard operation
sexpect copied to clipboard

[v2.3.13] interact -subst PATTERN::REPLACE

Open clarkwang opened this issue 3 years ago • 1 comments

interact <-subst|-sub> PATTERN::REPLACE

  • -nocase would cause PATTERN to be case-insensitive
  • -cstring impacts both PATTERN and REPLACE
  • REPLACE can include (0), (1), ..., (9) for RE match groups
    • For example, -subst "(foo)(bar)::(0) (1) (2)" would change foobar to foobar foo bar.
  • -subst can be specified for at most 10 times.

clarkwang avatar Aug 17 '22 15:08 clarkwang

For example, Dell iDRAC/racadm login looks like this:

image

With sexpect i -cstr -sub '(^|[\r\r])racadm>>::(1)(2)\e[1;35mracadm\e[1;34m> \e[m' it would become this:

image

clarkwang avatar Aug 24 '22 05:08 clarkwang