I have a long string which contains single quotes (') in it. I need to send this to mysql so I am trying to replace "'" with "\'" in the variable during the INSERT statement.
Example:
"This is the first single quote ', and this is the second '"
should become
"This is the first single quote \', and this is the second \'"
I've seen several examples with script replace and sed, but cannot figure this one out. Appreciate any help.
Thanks