I have a large file and some of the lines are as follows:
.... ....+*UNKNOWN* .... ....+*UNKNOWN* .... ....+*UNKNOWN* .... ....+*UNKNOWN* .... ....+*UNKNOWN* .... ....+*UNKNOWN* .... ....+*UNKNOWN* .... ....+*UNKNOWN*
I want to replace ….+UNKNOWN part with the ...+PUNCT
To do that, I did the following:
sed 's/....+*UNKNOWN*/...+PUNCT/g' myfile.out > myfile_result.out
However, none of the lines gone.
grep -F '...+*UNKNOWN*' myfile.out .... ....+*UNKNOWN* .... ....+*UNKNOWN* .... ....+*UNKNOWN* .... ....+*UNKNOWN* .... ....+*UNKNOWN* .... ....+*UNKNOWN* .... ....+*UNKNOWN* .... ....+*UNKNOWN*
I couldn’t find my error, could you help me about ?
Advertisement
Answer
In some versions of sed
, +
has a special meaning, use +
to match the plus literally.