From owner-freebsd-questions@FreeBSD.ORG Thu Oct 28 06:30:57 2010 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 8E7241065674 for ; Thu, 28 Oct 2010 06:30:57 +0000 (UTC) (envelope-from kline@thought.org) Received: from thought.org (plato.thought.org [209.180.213.209]) by mx1.freebsd.org (Postfix) with ESMTP id 64E778FC0C for ; Thu, 28 Oct 2010 06:30:57 +0000 (UTC) Received: by thought.org (Postfix, from userid 1001) id ADA58E823E8; Wed, 27 Oct 2010 23:30:37 -0700 (PDT) Date: Wed, 27 Oct 2010 23:30:37 -0700 From: Gary Kline To: FreeBSD Questions Message-ID: <20101028063037.GA9958@thought.org> References: <20101028010447.GA9734@thought.org> <20101028011055.GA68350@guilt.hydra> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101028011055.GA68350@guilt.hydra> X-Organization: Thought Unlimited. Public service Unix since 1986. X-Of_Interest: With 24 years of service to the Unix community. User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: okay, time to ask the wizards. 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: Thu, 28 Oct 2010 06:30:57 -0000 On Wed, Oct 27, 2010 at 07:10:55PM -0600, Chad Perrin wrote: > On Wed, Oct 27, 2010 at 06:04:50PM -0700, Gary Kline wrote: > > I've got a very large file with paragraphs separated only by "\n". > > How do I put a blank line _after_ each newline? > > perl -e 'while (<>) { s/$/\n/; print; }' > > You could also open the file in vi or Vim and give it this command: > > :%s/$/^M/ > > Note that you don't type in that ^M by using the ^ and M keys on the > keyboard. Instead, you first type ctrl-v then press the Enter key. > Thanks, much.... I've been editing the entire day [[ well, before I stopped to watch the ST DVD:-)]]. Then trying to remember how the hell to get a newline into a vi :sub. There is a way using tr that is among the tr man page examples. Not sure that will work. I'll put your perl exaple with -pi.bak into my ~/bin directory. That way, when my brain stalls I'll have it. gary PS: There are a few remaining regex tricks that I have to catch before I run the file thru atom. For now: calling "T"-- > -- > Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ] -- Gary Kline kline@thought.org http://www.thought.org Public Service Unix The 7.90a release of Jottings: http://jottings.thought.org/index.php http://journey.thought.org