From owner-freebsd-questions@FreeBSD.ORG Tue Sep 1 19:27:49 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A79151065676 for ; Tue, 1 Sep 2009 19:27:49 +0000 (UTC) (envelope-from lists@bertram-scharpf.de) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.10]) by mx1.freebsd.org (Postfix) with ESMTP id 393E68FC18 for ; Tue, 1 Sep 2009 19:27:49 +0000 (UTC) Received: from bs.l (e180031017.adsl.alicedsl.de [85.180.31.17]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0MKt2u-1MiZ193Lf0-000RqZ; Tue, 01 Sep 2009 21:27:47 +0200 Received: from bsch by bs.l with local (Exim 4.69) (envelope-from ) id 1MiZ19-0004l9-9n for freebsd-questions@freebsd.org; Tue, 01 Sep 2009 21:27:47 +0200 Date: Tue, 1 Sep 2009 21:27:47 +0200 From: Bertram Scharpf To: freebsd-questions@freebsd.org Message-ID: <20090901192747.GA18222@marge.bs.l> Mail-Followup-To: freebsd-questions@freebsd.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.16 (2007-06-09) Sender: Bertram Scharpf X-Provags-ID: V01U2FsdGVkX1+j4/CklF0j72EjxbdvTbq9jXASjneyPGm7hSR U3EEWXmrcDds7oJUMVa0qyLItUNuW4Zb7F3oencL4KKiBHDjrL DlHaFdKIdwvGxYop1NEE+E65yLr9to9znNzAjrpYiE= Subject: Re: remove newlines from a file X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Sep 2009 19:27:49 -0000 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