How do I combine all lines in a text file into a single line?
Posted
by
John
on Ask Ubuntu
See other posts from Ask Ubuntu
or by John
Published on 2012-07-16T01:25:27Z
Indexed on
2014/08/20
16:36 UTC
Read the original article
Hit count: 263
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
Here's the text file:
500212 262578-4-4 23200 GRIFFITH LABORATORIES LTD GRIFFITH LABORATORIES SOUTH DUBLIN COUNTY COUNCIL OFFICE OFFICE (INDUSTRIAL) List Rateable 2 Pineview Industrial Estate Firhouse Road Knocklyon 31 Dec 2007 01 Jan 2008"
I can't figure out where I've gone wrong....
© Ask Ubuntu or respective owner