From 83d4c0e6a47f0a2d377ebb2e733ab8afc4f256a3 Mon Sep 17 00:00:00 2001 From: Rottler Tamas Date: Wed, 8 Mar 2023 00:58:49 +0100 Subject: [PATCH] strip garbage after ': end' line --- routerbackup | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routerbackup b/routerbackup index 5d6c47d..5afea6e 100755 --- a/routerbackup +++ b/routerbackup @@ -374,6 +374,10 @@ class AsaConfig(ConfigWithShell): for i in range(0, 5): if re.search('^\s*: Saved\s*$', shrun[i]): del shrun[0:i] + # strip garbage after ': end' line + for i in range(-2, -6, -1): # -2! (-1 would delete all if : end is on last line) + if re.search('^\s*: end\s*$', shrun[i]): + del shrun[i+1:] iproute = [] for cmd in ('sh ip address', 'sh route'):