Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

sed -i 's/$/'/g' 
sed -i "s/$/'/g"

How to escape both $ and ' by 1 command?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
143 views
Welcome To Ask or Share your Answers For Others

1 Answer

This might work for you (GNU sed):

sed 's/$/'''/' file

Adds a single quote to the end of a line.

sed 's/$/'''/' file

Replaces a $ by a single quote.

sed 's/$$/'''/' file

Replaces a $ at the end of line by a single quote.

N.B. Surrounding sed commands by double quotes is fine for some interpolation but may return unexpected results.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...