Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Sep 2009 16:14:54 -0400
From:      Jerry McAllister <jerrymc@msu.edu>
To:        Paul Schmehl <pschmehl_lists@tx.rr.com>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: remove newlines from a file
Message-ID:  <20090901201454.GA54479@gizmo.acns.msu.edu>
In-Reply-To: <F2B402210EF1C4F7331B41C2@utd65257.utdallas.edu>
References:  <F2B402210EF1C4F7331B41C2@utd65257.utdallas.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Sep 01, 2009 at 06:03:19PM +0000, 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?

Use tr(1)     something like

    tr -d "[\n]"  < inputfile  > outputfile

////jerry    

> 
> -- 
> 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
> 
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090901201454.GA54479>