From: Roland G. <rgi...@cp...> - 2007-05-23 15:22:23
|
how about adjusting your regex to deal with one complete line after another? something like "Internet.*\n"? hope this helps, roland On 5/17/07, Jason Gerdes <JG...@cw...> wrote: > Hello, > > Here is the problem I am having: > > I use expect to spawn an SSH session to a cisco router and run the command 'show arp', which sends a lot of data back. example: > > gw>show arp > Protocol Address Age (min) Hardware Addr Type Interface > Internet XX.XX.108.17 0 XXXX.319f.c3d9 ARPA Vlan133 > Internet XX.XX.97.28 171 XXXX.c525.d4c3 ARPA Vlan122 > Internet XX.XX.99.30 41 XXXX.420c.e73f ARPA Vlan124 > ... (there are thousands of lines sent back) > > The problem I get is that expect seems to process this data in chunks. For example, it will process: > > Protocol Address Age (min) Hardware Addr Type Interface > Internet XX.XX.108.17 0 XXXX.319f.c3d9 ARPA Vlan133 > Internet XX.XX.97.28 171 XXXX.c5 > > where it will pull out the data correctly for the first line, but will not match the second line since it is incomplete. Then, it processes the next chunk. example: > > 25.d4c3 ARPA Vlan122 > Internet XX.XX.99.30 41 XXXX.420c.e73f ARPA Vlan124 > > where it will not pull the data correctly for the first line (incomplete), but will pull the correct data for the second line. > > I have used the TCL expect before and it does the same thing so I know it is not a bug. I think there is just a gap in my understanding of how expect processes the data that is sent back from spawned processes. > > Is there a way to make expect deal with all of the data as one big chunk, rather than processing it in pieces? I hope someone can explain how this works. > > > > --Jason > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > |