07-14-2017 08:53 AM
I'm looking to create a report on differences between files using TcL. One example is comparing a current configuration against a "baseline" configuration and reporting differences. I have this, which will return a 1 if there's a difference, or a zero if there's no difference, but I want to report the actual difference between the two files.
proc diffFileChunked {baseline current {chunksize 16384}} {
set f1 [open $baseline]; fconfigure $f1 -translation binary
set f2 [open $current]; fconfigure $f2 -translation binary
while {1} {
set d1 [read $f1 $chunksize]
set d2 [read $f2 $chunksize]
set diff [string compare $d1 $d2]
if {$diff != 0 || [eof $f1] || [eof $f2]} {
close $f1; close $f2
return $diff
}
}
}
Solved! Go to Solution.
07-14-2017 11:42 PM
There is a command in IOS that will show you the contextual diffs between any two text files. Just run the command "show archive config differences old_file new_file".
07-14-2017 11:42 PM
There is a command in IOS that will show you the contextual diffs between any two text files. Just run the command "show archive config differences old_file new_file".
07-17-2017 05:57 AM
Thanks Joe!
I didn't realize I can pull files from an external source with that, but it works perfectly.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide