<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: removing blank newlines using sed.</title>
	<link>http://www.thefraggle.com/2008/02/17/removing-blank-newlines-using-sed/</link>
	<description>technology, photography and anything else that comes into the rambling mind of chris ganderton</description>
	<pubDate>Thu, 21 Aug 2008 17:37:24 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: leE</title>
		<link>http://www.thefraggle.com/2008/02/17/removing-blank-newlines-using-sed/#comment-6300</link>
		<dc:creator>leE</dc:creator>
		<pubDate>Fri, 27 Jun 2008 13:32:03 +0000</pubDate>
		<guid>http://www.thefraggle.com/2008/02/17/removing-blank-newlines-using-sed/#comment-6300</guid>
		<description>It's actually faster to do this:

tr -d '\n'

Quick demo for you:

$ time (cat *.txt &#124; sed -e '/^$/d' &#62;&#62; /dev/null)

real    0m0.016s
user    0m0.018s
sys     0m0.001s


$ time (cat *.txt &#124; sed -e '/^$/d' &#62;&#62; /dev/null)

real    0m0.016s
user    0m0.018s
sys     0m0.001s


$ time (cat *.txt &#124; tr -d '\n' &#62;&#62; /dev/null)

real    0m0.010s
user    0m0.011s
sys     0m0.001s


$ time (cat *.txt &#124; tr -d '\n' &#62;&#62; /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>
