bash - LINUX - grep & comment out lines from fstab -
i'm updating fstab on over 500 servers. current fstab has old new nfs share lines. need comment old lines. instance:
nfs.old - temp file linea lineb linec /etc/fstab - current line1 line2 linea lineb linec line3 line4
run loop input nfs.old, find line in /etc/fstab & comment it
/etc/fstab - expected fstab line1 line2 #linea #lineb #linec line3 line4
thanks!
using awk can do:
awk 'fnr==nr {a[$0];next} ($0 in a){$0="#" $0} 1' nfs.old fstab line1 line2 #linea #lineb #linec line3 line4
bash shell awk sed grep
No comments:
Post a Comment