<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: removing blank newlines using sed.</title>
	<atom:link href="http://www.thefraggle.com/2008/02/17/removing-blank-newlines-using-sed/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thefraggle.com/2008/02/17/removing-blank-newlines-using-sed/</link>
	<description>technology, photography and anything else that springs to mind.</description>
	<lastBuildDate>Sat, 05 Mar 2011 15:59:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
	<item>
		<title>By: leE</title>
		<link>http://www.thefraggle.com/2008/02/17/removing-blank-newlines-using-sed/comment-page-1/#comment-6300</link>
		<dc:creator>leE</dc:creator>
		<pubDate>Fri, 27 Jun 2008 13:32:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.thefraggle.com/2008/02/17/removing-blank-newlines-using-sed/#comment-6300</guid>
		<description>It&#039;s actually faster to do this:

tr -d &#039;\n&#039;

Quick demo for you:

$ time (cat *.txt &#124; sed -e &#039;/^$/d&#039; &gt;&gt; /dev/null)

real    0m0.016s
user    0m0.018s
sys     0m0.001s


$ time (cat *.txt &#124; sed -e &#039;/^$/d&#039; &gt;&gt; /dev/null)

real    0m0.016s
user    0m0.018s
sys     0m0.001s


$ time (cat *.txt &#124; tr -d &#039;\n&#039; &gt;&gt; /dev/null)

real    0m0.010s
user    0m0.011s
sys     0m0.001s


$ time (cat *.txt &#124; tr -d &#039;\n&#039; &gt;&gt; /dev/null)

real    0m0.009s
user    0m0.011s
sys     0m0.001s


It should also leave a smaller memory footprint:

$ ls -lah `which tr`
-r-xr-xr-x  1 root  wheel    18K May 10 11:53 /usr/bin/tr
$ ls -lah `which sed`
-r-xr-xr-x  1 root  wheel    33K May 10 11:53 /usr/bin/sed


Every byte counts ;)</description>
		<content:encoded><![CDATA[<p>It&#8217;s actually faster to do this:</p>
<p>tr -d &#8216;\n&#8217;</p>
<p>Quick demo for you:</p>
<p>$ time (cat *.txt | sed -e &#8216;/^$/d&#8217; &gt;&gt; /dev/null)</p>
<p>real    0m0.016s<br />
user    0m0.018s<br />
sys     0m0.001s</p>
<p>$ time (cat *.txt | sed -e &#8216;/^$/d&#8217; &gt;&gt; /dev/null)</p>
<p>real    0m0.016s<br />
user    0m0.018s<br />
sys     0m0.001s</p>
<p>$ time (cat *.txt | tr -d &#8216;\n&#8217; &gt;&gt; /dev/null)</p>
<p>real    0m0.010s<br />
user    0m0.011s<br />
sys     0m0.001s</p>
<p>$ time (cat *.txt | tr -d &#8216;\n&#8217; &gt;&gt; /dev/null)</p>
<p>real    0m0.009s<br />
user    0m0.011s<br />
sys     0m0.001s</p>
<p>It should also leave a smaller memory footprint:</p>
<p>$ ls -lah `which tr`<br />
-r-xr-xr-x  1 root  wheel    18K May 10 11:53 /usr/bin/tr<br />
$ ls -lah `which sed`<br />
-r-xr-xr-x  1 root  wheel    33K May 10 11:53 /usr/bin/sed</p>
<p>Every byte counts <img src='http://www.thefraggle.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>

