The Windows and Linux operating systems have a slight variation in how they handle newlines in files. Typically, in the Windows environment a line is terminated with the two characters \r\n. The \r character represents a carriage return, and \n represents a newline. In Linux, only the \n character is used to terminate a line.
This causes some interesting behavior issues when moving between the Windows and Linux environment. For example, if you have a multi-line text file that was created in Linux, and then try to open it using a program such as Windows Notepad, the entire contents of the file will appear on a single line.
You can use the sed command to convert the file fileLinux.txt to Windows line breaks:
sed -i 's/$/\r/' fileLinux.txt
The -i option tells sed to write the results back to the input file. The s is sed's substitute command. The $ is a regular expression that matches the end of a line, and \r is the carriage return.
To convert from Windows to Linux line breaks you can use the tr command and simply remove the \r characters from the file.
sed -i 's/\r//' fileWindows.txt