remove newlines from a file

Paul Schmehl pschmehl_lists at
Tue Sep 1 20:04:45 UTC 2009

--On Tuesday, September 01, 2009 13:55:37 -0500 Mak Kolybabi <mak at> 

> On 2009-09-01 18:03, 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?
> Personally, I'd use:
> % tr -d '\n' < inputfile

Personally, I like your solution.  :-)

Paul Schmehl, Senior Infosec Analyst
As if it wasn't already obvious, my opinions
are my own and not those of my employer.
"It is as useless to argue with those who have
renounced the use of reason as to administer
medication to the dead." Thomas Jefferson

More information about the freebsd-questions mailing list