0

New line should be replaced with ',' please ignore the brackets only the special characters inside it

I have already tried two commands

sed -i ':a;N;$!ba;s/\n/\','/g' test.txt - This command replaces the new line with , but the quotes are not coming

sed -i ':a;N;$!ba;s/\n/\'\,\'/g' test.txt - I tried giving escape character for all the three Special characters but this time terminal asks me for next line input i.e ( > )

Example below :

aaa

bbb

ccc

'aaa','bbb','ccc'

0 Answers0