From owner-freebsd-questions@FreeBSD.ORG Tue Sep 1 19:05:48 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 C562F1065676 for ; Tue, 1 Sep 2009 19:05:48 +0000 (UTC) (envelope-from rjgonzale@estrads.com.ar) Received: from outbound-mail-23.bluehost.com (outbound-mail-23.bluehost.com [69.89.21.18]) by mx1.freebsd.org (Postfix) with SMTP id 7E4BA8FC08 for ; Tue, 1 Sep 2009 19:05:48 +0000 (UTC) Received: (qmail 26513 invoked by uid 0); 1 Sep 2009 18:39:08 -0000 Received: from unknown (HELO box511.bluehost.com) (74.220.219.111) by outboundproxy2.bluehost.com with SMTP; 1 Sep 2009 18:39:08 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=estrads.com.ar; h=Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding:X-Identified-User; b=U8PgFEEzkaUGDaVFqUA4fPTXN+40TWBnjbVhrz0L/oqaSAlsL9FDdF4UMzboEG3//s0FwutuIKF1Xn+V9LZZk0oze1xx8OrUGj18m6cL+V4rwndPqfth9UnxXlJ+PP5r; Received: from host130.200-82-120.telecom.net.ar ([200.82.120.130] helo=localhost.localdomain) by box511.bluehost.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1MiYFz-0007NO-4a; Tue, 01 Sep 2009 12:39:07 -0600 Message-ID: <4A9D6A42.1010700@estrads.com.ar> Date: Tue, 01 Sep 2009 15:38:58 -0300 From: Rodrigo Gonzalez User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Lightning/1.0pre Thunderbird/3.0b3 MIME-Version: 1.0 To: Paul Schmehl References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Identified-User: {32647:box511.bluehost.com:gonosade:estrads.com.ar} {sentby:smtp auth 200.82.120.130 authed with rjgonzale@estrads.com.ar} 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 19:05:48 -0000 On 09/01/2009 03:03 PM, 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? > A simple solution could be using tr command tr -d '\012' < file > output_file