nanog mailing list archives
Re: Managing IOS Configuration Snippets
From: Robert Drake <rdrake () direcpath com>
Date: Sun, 2 Mar 2014 13:13:41 -0500
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.
Current thread:
- Re: Managing IOS Configuration Snippets Dale W. Carder (Feb 28)
- Re: Managing IOS Configuration Snippets Robert Drake (Mar 02)
- <Possible follow-ups>
- Re: Managing IOS Configuration Snippets Dale W. Carder (Feb 28)
- Re: Managing IOS Configuration Snippets Keegan Holley (Feb 28)
- Re: Managing IOS Configuration Snippets Elle Janet Plato (Mar 02)