Quick question about sed
not replacing a second string.
I have two blocks of data; sed
will replace the first block of data but it won't or replace some of the second string of data.
first block of data
abcd_0000001=/var/tmp /0000001
abcd_0000001=Y
abcd_0000001=
abcd_0000001=[A-za-z]*.*
abcd_0000001=/tmp/
abcd_0000001=1
abcd_0000001=true
abcd_0000001=pwd
abcd_0000001=scp
abcd_0000001=
second block of data
74747_cnn=/opt/0000001
74747_cnn=
74747_cnn=pwd
74747_cnn=1
74747_cnn=/
74747_cnn=/usr
74747_cnn=/usr/74747_cnn7
74747_cnn=
74747_cnn=scp
74747_cnn=true
If I want to replace abcd_0000001
with defg_0000077
and 74747_cnn
with 19197_abc
and 0000001
with 0000001AJC
, then …
sed
will replace the first block of data and will replace some of text from the second block of data.
It will replace cnn
with _abc
but it will not replace 74747
.
What am I missing or doing wrong?
I am using the following:
sed -i 's/abcd_0000001/defg_0000077/g; s/74747_cnn/19197_abc/g; s/0000001/0000001AJC/g' file.txt