Posted to tcl by schelte at Wed Mar 12 21:48:42 GMT 2014view pretty

    spawn telnet $ip
    match_max 100000
    expect -exact "Username:"
    send -- "$user\r"
    expect -exact "Password:"
    send -- "$password\r"
    expect -exact "#"
    send -- "terminal length 0\r"
    expect -exact "#"
    send -- "show run\r"
    expect -exact "#"
    set lines [split [string map [list \r\n \n] $expect_out(buffer)] \n]
    send -- "exit\r"
    expect eof
    wait -nowait