How would I replace a single quote (‘) with a backslash then single quote (\’) using sed?
sed s/\'/\\\'/
won’t work because you never get to write the literal .
sed ":a;N;s/\'/\\'/g" <file1 >file2
won’t work because the backslash will no longer escape the quote, it get’s treated like a regex quote.
just quote the replacement
e.g