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

Gretchen Dziengel gdziengel at gmail.com
Wed Jul 11 18:52:01 UTC 2007


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.
It's very frustrating because the replace works just fine if I do it in vim,
but I'm going to be running this every day so I don't want to do it by hand.

Gretchen


More information about the Techtalk mailing list