#!/bin/bash mkdir -p tmp ls -1 *.conf | while read file; do # Remove rusk & rask sed -E \ -e 's/secret ".+";/secret "";/g' \ -e 's/encrypted-password ".+";/encrypted-password "";/g' \ -e 's/"scp:\/\/.+" password ".+";/"scp:\/\/user\@host\/some\/folder\/" password "";/g' \ -e 's/serial-number .+;/serial-number ;/g' \ -e 's/community .+ /community /g' \ -e '/\/\* dat/d' \ -e '/\/\* tad/d' \ -e 's/ecdsa-sha2-nistp256-key .+;/ecdsa-sha2-nistp256-key ;/g' \ -e 's/collector .+;/collector ;/g' \ -e 's/authentication-key ".+"/authentication-key "";/g' \ -e 's/LU[0-9]+/LU1337/g' \ -e 's/SB[0-9]+/SB1337/g' \ -e 's/ssh-ed25519 .+;/ssh-ed25519 "";/g' \ -e 's/contact .+;/contact "";/g' \ $file > tmp/$file # Remove SSH-host-info sed -i '' \ -e '/ssh-known-hosts {/ {' -e 'n; s/host .\+ {/host {/' -e '}' \ tmp/$file # Remove stuff from ACL's sed -i '' \ -e ':again' -e N -e '$!b again' \ -e 's/prefix-list mgmt-v4 {[^}]*}/prefix-list mgmt-v4 {\n }/g' \ tmp/$file sed -i '' \ -e ':again' -e N -e '$!b again' \ -e 's/prefix-list mgmt-v6 {[^}]*}/prefix-list mgmt-v6 {\n }/g' \ tmp/$file done