Last active
May 27, 2019 02:35
-
-
Save guskma/3d45602b382a8e17fcf4cf26a53dfa3b to your computer and use it in GitHub Desktop.
description変更しただけのconfigから投入configを作るだけのやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 解説: | |
# こんな感じの差分があるコンフィグから | |
# interface GigabitEthernet1/0/1 | |
# - description hoge | |
# + description fuga | |
# ! | |
# こんな感じの投入コンフィグを作るためのパイプラインサンプルです。 | |
# interface GigabitEthernet1/0/1 | |
# description fuga | |
# exit | |
/usr/bin/diff config.txt config_parsed.txt \ | |
--new-line-format='%L' \ | |
--unchanged-line-format='%L' \ | |
--old-line-format='!!!!%L' | \ | |
grep -E 'interface|description|!' | \ | |
grep '!!!!' -A 2 -B 1 | \ | |
grep -vE '^--|!!!!' | \ | |
sed -r 's/!/exit\n/g' > config_description.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment