On 2/28/2014 9:19 PM, Dale W. Carder wrote:
If I'm understanding what you're trying to do, you could script around our rather unsophisticated 'sgrep' (stanza grep) tool combined with scripting around rancid & rcs to do what I think you are looking for.
http://net.doit.wisc.edu/~dwcarder/scripts/sgrep
sgrep can dump out a "stanza" of ios-like config, then you can rcsdiff that to your master, per 'chunk' of config. Dale
I'm digging the idea of your command. Along the same lines I've got this awk snippet that I made and then forgot about. It functions like the cisco pipe begin/end commands: #!/bin/sh if [ "x${2}" = "x" ]; then awk "/${1}/{temp=1}; temp==1{print}" else awk "/${1}/{temp=1};/${2}/{temp=0}; temp==1{print}" fi Usage: cat router-confg | begin_regex 'line vty' '!' If you omit the second argument it just shows you from your match until the end of file.