remove newlines from a file

Rodrigo Gonzalez rjgonzale at estrads.com.ar
Tue Sep 1 19:05:48 UTC 2009


On 09/01/2009 03:03 PM, Paul Schmehl wrote:
> I found a sed tutorial once that did this, but I can't seem to find it
> again. I have a file with multiple lines, each of which contains a
> single ip followed by a /32 and a comma. I want to combine all those
> lines into a single line by removing all the newline characters at the
> end of each line.
>
> What's the best/most efficient way of doing that in a shell?
>

A simple solution could be using tr command

tr -d '\012' < file > output_file



More information about the freebsd-questions mailing list