merge multiple lines of a single file into one line
I would like to merge two or more line of a single file into one line, can some body help me
it depends on how the line is terminated.
you can look at it with cat -A <file>
unix text will end with $
dos text will end with ^M$
tr '\012\015' '' < filenamefrom > filenameto
will remove carriage return newline from a dos text file
edit: i think that should have been
tr -d '\012\015' < filenamefrom > filenameto
Moved: This thread is more suitable in Linux - Newbie and has been moved accordingly to help your thread/question get the exposure it deserves.
What about for Unix?
What I cat -a FILE I get a $ at the end of the line.
do you just want to remove the newline, or do you want it replaced with a space character?
tr -d '\012' < infile > outfile
tr '\012' ' ' <infile>outfile
replaces with a space
looks like i made a mistake in my answer above.
|All times are GMT -5. The time now is 06:38 AM.|