[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Managing IOS Configuration Snippets
- Subject: Managing IOS Configuration Snippets
- From: rdrake at direcpath.com (Robert Drake)
- Date: Sun, 2 Mar 2014 13:13:41 -0500
- In-reply-to: <[email protected]>
- References: <CAGWL9Q3jm-xwUAEHVzurQrAypa0N0rXe5SRU2C=dqT-9g15Hsw@mail.gmail.com> <[email protected]> <[email protected]> <CAGWL9Q31uBVVk57pn6Xmg9K-b_zFPX1N+KBCAzCV9VhQ7mMcQQ@mail.gmail.com> <[email protected]>
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.