Skip to content

Instantly share code, notes, and snippets.

@RavuAlHemio
Created April 6, 2021 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RavuAlHemio/e219d84e23a20a426d75b11c131806aa to your computer and use it in GitHub Desktop.
Save RavuAlHemio/e219d84e23a20a426d75b11c131806aa to your computer and use it in GitHub Desktop.
awk script that does similar filtering to Cisco's "section" filter (show running-config | section ^interface Vlan)
/^[^ ]/{printage = 0;} /PATTERN/{printage = 1;} { if (printage) { print $0; } }
Example:
awk '/^[^ ]/{printage = 0;} /^interface Vlan/{printage = 1;} { if (printage) { print $0; } }' configfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment