send "show run\r" expect { # Last configuration change at 21:41:09 EDT Tue Aug 22 2006 by haleb # NVRAM config last updated at 21:41:09 EDT Tue Aug 22 2006 by haleb -re "Last configuration change at \[0-9\]\[0-9\]:\[0-9\]\[0-9\]:\[0-9\]\[0-9\] \[A-Z\]\[A-Z\]\[A-Z\] \[A-Za-z\].+ \[A-Za-z\].+ \[0-9\]+\[0-9\]+ by \[A-Za-z\]+" { set lcdate "" append date "[lindex $expect_out(0,string) 4] " append date "[lindex $expect_out(0,string) 5] " append date "[lindex $expect_out(0,string) 6] " append date "[lindex $expect_out(0,string) 7] " append date [lindex $expect_out(0,string) 8] set lcsdate [exec date +%s -d "$date"] puts "###### Date: $lcdate -- $lcsdate ######" } }