backspace issue on linux file

Setting the "line ending sequence" in VSCode / atom from CRLF TO LF and saving worked for me


You need to change file preferences: go to Preferences -> Files and change "Create new file as " to UNIX. Also, your might want to enable "Check invalid CR/LF, null character when loading" option.


For already produced files

cat OLDFILE | tr -d '\r' > NEWFILE 

should help. You can't just redirect the output to the input:

cat FILE | tr -d '\r' > FILE 

since this will truncate the input file before it is read.

In contrast to similar programs, this is not eligible for the useless-use-of-cat award, since tr doesn't accept a filename as parameter.