Sadece sed komutunun dışındaki çift tırnak kullanın.
$ sed "s/ones/one's/" <<< 'ones thing'
one's thing
Dosyalarla da çalışır. Eğer dize içinde tek ve çift tırnak varsa
$ echo 'ones thing' > testfile
$ sed -i "s/ones/one's/" testfile
$ cat testfile
one's thing
, bu çok sorun değil. Sadece çift tırnaktan kaç.
Örneğin, bu dosya hem tek hem de çift tırnaklı bir dizgi içerir. Tek bir alıntı eklemek ve bazı çift tırnakları kaldırmak için sed kullanacağım.
$ cat testfile
"it's more than ones thing"
$ sed -i "s/\"it's more than ones thing\"/it's more than one's thing/" testfile
$ cat testfile
it's more than one's thing
(http://stackoverflow.com/questions/1250079/escaping-single-quotes-within-single-quoted-strings) – buff
kısa [Tek tırnak içindeki tek tırnak Kaçan] olası yinelenen Cevap "[bunu yapamazsınız] (http://www.gnu.org/software/bash/manual/bashref.html#Single-Quotes)" - tüm çalışmaların iyi sunulduğu çözümler. –