This is what I tried: sed -i 's/^.*/"$&"/' myFile.txt
It put a $ at the beginning of every line.
@DummyHead Here's another approach: if you use single quotes, the sed command is exactly as you type it. If you use double quotes, you must take into account all shell substitutions and elaborations to "visualize" what command is eventually passed on to sed.
You can tell sed to carry out multiple operations by just repeating -e (or -f if your script is in a file). sed -i -e 's/a/b/g' -e 's/b/d/g' file makes both changes in the single file named file , in-place.
If you need to use the double quote inside the string, you can use the backslash character. Notice how the backslash in the second line is used to escape the double quote characters. And the single quote can be used without a backslash.
You basically have sed 's/' followed by /"/' , which is a slash and an unclosed double quoted string. you have no such problem. This is sed 's/' followed by "'" (a double quoted single quote), followed by '/"/' .
here it is
sed 's/\(.*\)/"\1"/g'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With