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.

t0xic
  • 535
  • 1
  • 4
  • 5
  • 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

1 Answers1

2
sed -i 's/\r/\n/g' thefile.txt

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

glenn jackman
  • 85,964