With your shown samples, try following. Written and tested with shown samples in GNU sed
.
sed -E 's/([0-9a-eA-E]{2}:){5}[0-9a-eA-E]{2}/XX:XX:XX:XX:XX:XX/g' Input_file
Explanation: Simply using -E
option of sed
which enables ERE for regex. Then using s
(substitution option) to substitute ([0-9a-eA-E]{2}:){5}
digits, alphabets(small OR capital letters) 2 in number followed by a colon, then this combination should be there 5 times{5}
and then again matching alphabets(small, capital letters) and digits 2 occurrences if match is found of this regex substitute them with XX:XX:XX:XX:XX:XX
. using g
option to globally substitute all matched/found matched ones with new value.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…