Date: Wed, 27 Oct 2010 23:30:37 -0700 From: Gary Kline <kline@thought.org> To: FreeBSD Questions <freebsd-questions@freebsd.org> Subject: Re: okay, time to ask the wizards. Message-ID: <20101028063037.GA9958@thought.org> In-Reply-To: <20101028011055.GA68350@guilt.hydra> References: <20101028010447.GA9734@thought.org> <20101028011055.GA68350@guilt.hydra>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101028063037.GA9958>