0

I am trying to port a C++ program from Windows to Ubuntu . In Ubuntu environment , My program reads a text file which was created in Windows , however it appears the Carriage Return is affecting the reading of the file in Ubuntu environment , therefore I wish to remove all the Carriage Return .

I have tried the following command on Windows to convert the text file to Linux format

dos2unix User.txt User1.txt

I also tried this

 tr -d '\15\32' < User.txt > User1.txt

Both these methods dont work , I am getting the following error :

is not recognised as an internal or external command , op program , or batch file

What am I doing wrong here ??

2
  • What text editor are you using in Ubuntu?
    – colboynik
    Feb 12, 2014 at 6:08
  • gedit text editor Feb 12, 2014 at 6:39

1 Answer 1

1

I have tried the following command on Windows to convert the text file to Linux format

Try to run the commands on your Ubuntu machine. tr is in coreutils and therefore always available, dos2unix needs to be installed.

As a side note: In Python, a file object has the attribute newlines, that stores all end-of-line characters in a tuple. Is something similar available for C++?

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .