How to enclose every line in a file in double quotes with sed?
You almost got it right. Try this slightly modified version:
sed 's/^.*$/"&"/g' file.txt
shorter
sed 's/.*/"&"/'
without spaces
sed 's/ *\(.*\) *$/"\1"/'
skip empty lines
sed '/^ *$/d;s/.*/"&"/'
here it is
sed 's/\(.*\)/"\1"/g'