Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Sep 2009 21:27:47 +0200
From:      Bertram Scharpf <lists@bertram-scharpf.de>
To:        freebsd-questions@freebsd.org
Subject:   Re: remove newlines from a file
Message-ID:  <20090901192747.GA18222@marge.bs.l>
In-Reply-To: <F2B402210EF1C4F7331B41C2@utd65257.utdallas.edu>
References:  <F2B402210EF1C4F7331B41C2@utd65257.utdallas.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

Am Dienstag, 01. Sep 2009, 18:03:19 +0000 schrieb Paul Schmehl:
> 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?

Probably this:

  $ echo `cat ip-file`
  $ ipline=`cat ip-file`
  $ echo $ipline | wc -l

Bertram


-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de



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