5

How do I combine all lines in a text file into a single line?

view full story
linux-howto

http://askubuntu.com – I want to get all lines in a text into one line. I'm a beginner at coding trying to learn by doing. I've spent four hours trying to solve this problem. I know there's a simple solution to this problem. Here's what I've been trying. sed -e 'N;s/\n//' myfile.txt #Does nothing sed -e :a -e N -e 's/\n/ /' -e ta myfile.txt #output all messed up and I can't make head nor tail of the syntax cat myfile.txt | tr -d '\n' > myfile.txt # Deletes all lines I can't figure out where I've gone wrong. If anyone has any idea of where I'm going wrong It would be a great help. Cheers. Thanks for all the (HowTos)