This question already has an answer here:
I have a file that contains string in each line. I used this file as an input in a program that reads them automatically. The program seem to not be able to read the strings correctly. I tried to fiure out what is different than usual. The only thing I found is that the file (I take it as-is from a source) adds the newline character at the beginning of the new line, and not at the end of the previous line as I used to see and as the program could successfully read previous files.
So if I use
cat -E file.txt to see the newline character I see the file contains string like this:
string1 $string2 $string3 $string4
Note that the
$ is the newline character.
As a troubleshooting step, I want to change the newline position to be:
string1$ string2$ string3$ string4$
How to do this?