@ksaj Depending on what you are doing, you may be getting tangled up with Linux/Windows text file format differences. Windows uses two characters for end-of-line: CR (carriage return) + LF (line-feed), while Linux convention puts only the LF char at the end of each line.
Many Linux distributions have utility commands "dos2unix" and "unix2dos" that convert back and forth.