From owner-freebsd-questions@FreeBSD.ORG Tue Sep 1 18:55:40 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 30B7D1065670 for ; Tue, 1 Sep 2009 18:55:40 +0000 (UTC) (envelope-from mak@kolybabi.com) Received: from mail.nepharia.org (mail.nepharia.org [209.44.104.71]) by mx1.freebsd.org (Postfix) with ESMTP id 09CF38FC0A for ; Tue, 1 Sep 2009 18:55:39 +0000 (UTC) Received: from brisbane.nepharia.org (wnpgmb0807w-ad02-161-57-125.dynamic.mts.net [207.161.57.125]) by mail.nepharia.org (Postfix) with ESMTPSA id A62063F0E99; Tue, 1 Sep 2009 13:55:38 -0500 (CDT) Received: by brisbane.nepharia.org (nbSMTP-1.00) for uid 1000 (using TLSv1/SSLv3 with cipher DHE-RSA-AES256-SHA (256/256 bits)) mak@kolybabi.com; Tue, 1 Sep 2009 13:55:38 -0500 (CDT) Date: Tue, 1 Sep 2009 13:55:37 -0500 From: Mak Kolybabi To: Paul Schmehl Message-ID: <20090901185537.GA25956@brisbane.nepharia.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.16 (2007-06-09) Cc: FreeBSD Questions 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 18:55:40 -0000 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 -- Matthew Anthony Kolybabi (Mak) () ASCII Ribbon Campaign | Against HTML e-mail /\ www.asciiribbon.org | Against proprietary extensions