I want to replace the '\n'
characters in each line with a longer string, e.g.: "___\n"
.
When I try:
$ cat /tmp/test.csv | sed ':a;N;$!ba;s/\n/____\n/g'
I get the following output
"00000";"29515470";"001";"001";"A6399000800";"";"";"-1";"142.72";"1.00";"1.00"____
"91930";"20029956";"001";"002";"A2128300018";"";"";"-1";"71.58";"1.00";"4.00"____
"91930";"20029962";"001";"003";"ZZ-OIL16";"";"";"-1";"14.48";"5.00";"3.00"____
"91930";"20029962";"001";"002";"A2661800009";"";"";"-1";"13.28";"1.00";"3.00"
Where the very last '\n' is not not replaced.
But my CSV file looks like this:
How can I replace ALL \n
characters?
I've found this:
How can I replace a newline (\n) using sed?
, but this solution is not good for me, because it does not handle the very last '\n'
character.