okay, time to ask the wizards.

Gary Kline kline at thought.org
Thu Oct 28 06:39:00 UTC 2010


On Wed, Oct 27, 2010 at 07:29:25PM -0600, Chad Perrin wrote:
> On Wed, Oct 27, 2010 at 06:14:04PM -0700, Nerius Landys wrote:
> > You mean replace each newline character with two newline characters?
> > 
> > perl -p -i -e 's/\n/\n\n/g' yourfile.txt
> 

	Hm.  Didn't think of perl; but yeah.

> The g in that is unnecessary.  I'd also be inclined to use $ in the
> matching part of that regex than \n, and only require one newline
> character in the substitution part as a result:
> 
>     perl -pie 's/$/\n/' filename.txt


	I think the '$' wins because there might be an embedded newline.
	The pdf2html utility uses them to match the page-size of the
	PDF.
> 
> Plus . . . I like pie.


	Yup.

	-g

> 
> -- 
> Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]



-- 
 Gary Kline  kline at 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
                                        


More information about the freebsd-questions mailing list