0

I have a .txt file from my Mac that when I send it over to my Raspberry Pi running Raspbian and open it in nano it converts weirdly. Example:

Text file in Mac OSX:

http://welcome.hp.com/country/us/en/prodserv/servers.html
http://www8.hp.com/us/en/products/data-storage/overview.html

Text file in Raspbian:

Servers & Blades
Storage
http://welcome.hp.com/country/us/en/prodserv/servers.html^Mhttp://www8.hp.com/us/en/products/data-storage/overview.html        

Any help is appreciated.

  • It looks like your file has a mixture of different types of line endings. Please post the output of od -t x1 thefile.txt (the output should be the same on both machines). Do you care about which type of line ending is used, or do you just want an ordinary text file? – Gilles 'SO- stop being evil' May 26 '15 at 23:22
2
sed -i 's/\r/\n/g' thefile.txt

"classic" macos used \r as the end-of-line character. *nix uses \n

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.