[Techtalk] Escaping single quotes in a file with a bash script

Kathryn Hogg kjh at flyballdogs.com
Wed Jul 11 19:37:29 UTC 2007


Gretchen Dziengel wrote:
> On 7/11/07, Kathryn Hogg <kjh at flyballdogs.com> wrote:
>
>>
>> Use double quotes for the outer level:
>>
>> sed -e "s/'/\\\'/" infile outfile
>
>
>
> That makes perfect sense, but it's still not working for me.
> sed -e "s/\'/\\\'/" step24.txt > step25.txt
>
> Now it adds \' on to the end of every line, and still doesn't find the '
> in
> O'Rourke.

$ cat testme
Kathryn Hogg
Caroline O'Conner
$  sed -e "s/'/\\\'/" testme
Kathryn Hogg
Caroline O\'Conner
$


-- 
Kathryn
http://womensfooty.com


More information about the Techtalk mailing list