There is no need to create a regular expression (with a reverse request) for this task. This is an expensive operation since you are not going to change anything in the line. The easiest way is to simply print them.
awk '{print "\042"$0"\042,"}' file
The results of work in a large file:
$ head -5 file
this is line
this is line
this is line
this is line
this is line
$ wc -l < file
9545088
$ time awk '{print "\042"$0"\042,"}' file >/dev/null
real 0m15.574s
user 0m15.327s
sys 0m0.172s
$ time sed 's/.*/"&",/' file > /dev/null
real 0m31.717s
user 0m31.465s
sys 0m0.157s
$ time perl -p -e 's/^(.*)$/\"$1\",/g' file >/dev/null
real 0m36.576s
user 0m36.006s
sys 0m0.360s
source
share