Starting EXPECT pattern matching... at /usr/local/share/perl5/Expect.pm line 597 Expect::expect('Expect=GLOB(0x22cd510)', 60, '-re', ']MyPrompt>|]MyPrompt#|]MyPrompt...') called at ./get_ippools_exp.pl line 192 main::cmd('Expect=GLOB(0x22cd510)', 'show config context data | grep "ip pool"') called at ./get_ippools_exp.pl line 75 main::getPools() called at ./get_ippools_exp.pl line 25 spawn id(4): beginning expect. Timeout: 60 seconds. Current time: Fri Aug 26 13:50:58 2016 Waiting for new data (60 seconds)... spawn id(4): new data. spawn id(4): read 92 byte(s). show config context data | grep "ip pool" Friday August 26 18:50:58 UTC 2016 Waiting for new data (60 seconds)... spawn id(4): new data. spawn id(4): read 1815 byte(s). ip pool data1 ... ip pool data2 ... ip pool data16 ... Waiting for new data (56 seconds)... spawn id(4): new data. spawn id(4): read 2048 byte(s). ip pool data17 ... ip pool data18 ... ip pool data38 ... ip Waiting for new data (56 seconds)... spawn id(4): new data. spawn id(4): read 351 byte(s). pool data39 ... ip pool data40 ... ip pool data41 ... Waiting for new data (56 seconds)... spawn id(4): new data. spawn id(4): read 33 byte(s). <----here it receives the prompt!!!! [local]MyPrompt> Returning from expect successfully. spawn id(4): accumulator: ` '<----You can see that the buffer is dumped