neuhru has asked for the wisdom of the Perl Monks concerning the following question:

Hi Perlmonks,

I am new to Expect and find it very useful. At any rate, I am using Expect to access another system. The returned prompt contains the following format:

"Mon Aug 13 17:04:31 2012 JTSOC> "

The date and time continually changes and as a result, I am having a difficult time using waitfor() for the expected prompt.

How can have expect look for "JTSOC> " in the prompt since I know that part of the prompt is not changing so I can issue the next command to execute?

Thanks in advance!

Neuhru
  • Comment on Perl Expect Prompt: Waitfor Specific Character

Replies are listed 'Best First'.
Re: Perl Expect Prompt: Waitfor Specific Character
by roboticus (Chancellor) on Aug 16, 2012 at 01:29 UTC

    neuhru:

    Just specify "JSTOC>" as the string or regex to wait for. You don't have to specify an expression to match the entire line.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Thanks roboticus!

      That worked.

Re: Perl Expect Prompt: Waitfor Specific Character
by SerZKO (Beadle) on Aug 16, 2012 at 08:16 UTC
    Or you could specify "*JTSOC>".

      Thanks SerZKO

      That worked as well.