<?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/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	
	>
<channel>
	<title>
	Comments on: Let&#8217;s have a look at cat (Linux, bash)	</title>
	<atom:link href="https://gregladen.com/blog/2009/05/13/lets-have-a-look-at-cat-linux/feed/" rel="self" type="application/rss+xml" />
	<link>https://gregladen.com/blog/2009/05/13/lets-have-a-look-at-cat-linux/</link>
	<description></description>
	<lastBuildDate>Thu, 14 May 2009 10:40:54 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.6</generator>
	<item>
		<title>
		By: AnonymousCoward		</title>
		<link>https://gregladen.com/blog/2009/05/13/lets-have-a-look-at-cat-linux/#comment-535724</link>

		<dc:creator><![CDATA[AnonymousCoward]]></dc:creator>
		<pubDate>Thu, 14 May 2009 10:40:54 +0000</pubDate>
		<guid isPermaLink="false">http://scienceblogs.com/gregladen/2009/05/13/lets-have-a-look-at-cat-linux/#comment-535724</guid>

					<description><![CDATA[While cat certainly is a very useful tool, you should remember that it&#039;s essentially bound to the drive IO and not the CPU. A useless use of cat (UUOC) causes a file to be read repeatedly and unnecessarily and the performance degradation can&#039;t be overcome with more cores or faster clock speeds.

Consider:
&lt;b&gt;$ cat file &#124; grep foo&lt;/b&gt;
versus:
&lt;b&gt;$ grep foo file&lt;/b&gt;

This can seem pretty trivial with tiny files, but if the file is large or the storage is slow the effects can be extremely painful.

I ran the following unscientific benchmark using a 7MB text file:

&lt;b&gt;$ time grep foo foo.csv &gt; /dev/null&lt;/b&gt;

real    0m0.172s
user    0m0.093s
sys     0m0.046s

&lt;b&gt;$ time cat foo.csv &#124; grep foo &gt; /dev/null&lt;/b&gt;

real    0m4.238s
user    0m3.951s
sys     0m0.264s

Imagine if that file&#039;s size was greater than a GB!]]></description>
			<content:encoded><![CDATA[<p>While cat certainly is a very useful tool, you should remember that it&#8217;s essentially bound to the drive IO and not the CPU. A useless use of cat (UUOC) causes a file to be read repeatedly and unnecessarily and the performance degradation can&#8217;t be overcome with more cores or faster clock speeds.</p>
<p>Consider:<br />
<b>$ cat file | grep foo</b><br />
versus:<br />
<b>$ grep foo file</b></p>
<p>This can seem pretty trivial with tiny files, but if the file is large or the storage is slow the effects can be extremely painful.</p>
<p>I ran the following unscientific benchmark using a 7MB text file:</p>
<p><b>$ time grep foo foo.csv > /dev/null</b></p>
<p>real    0m0.172s<br />
user    0m0.093s<br />
sys     0m0.046s</p>
<p><b>$ time cat foo.csv | grep foo > /dev/null</b></p>
<p>real    0m4.238s<br />
user    0m3.951s<br />
sys     0m0.264s</p>
<p>Imagine if that file&#8217;s size was greater than a GB!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: John Swindle		</title>
		<link>https://gregladen.com/blog/2009/05/13/lets-have-a-look-at-cat-linux/#comment-535723</link>

		<dc:creator><![CDATA[John Swindle]]></dc:creator>
		<pubDate>Thu, 14 May 2009 03:48:17 +0000</pubDate>
		<guid isPermaLink="false">http://scienceblogs.com/gregladen/2009/05/13/lets-have-a-look-at-cat-linux/#comment-535723</guid>

					<description><![CDATA[Somehow, Sean neglected what seems to me to be another obvious use of cat.  With the &quot;double greater-than&quot; operator, (&gt;&gt;) cat will add text to an existing file. I use this about once a week.

  I have yet to use cat to write a program of any kind, but the World Bank hack does sound like an interesting challenge. ]]></description>
			<content:encoded><![CDATA[<p>Somehow, Sean neglected what seems to me to be another obvious use of cat.  With the &#8220;double greater-than&#8221; operator, (>>) cat will add text to an existing file. I use this about once a week.</p>
<p>  I have yet to use cat to write a program of any kind, but the World Bank hack does sound like an interesting challenge. </p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Barry Rountree		</title>
		<link>https://gregladen.com/blog/2009/05/13/lets-have-a-look-at-cat-linux/#comment-535722</link>

		<dc:creator><![CDATA[Barry Rountree]]></dc:creator>
		<pubDate>Thu, 14 May 2009 01:14:32 +0000</pubDate>
		<guid isPermaLink="false">http://scienceblogs.com/gregladen/2009/05/13/lets-have-a-look-at-cat-linux/#comment-535722</guid>

					<description><![CDATA[No mention of &#039;tac&#039;?

tac - concatenate and print files in reverse

Definitely a why-the-hell-would-anyone-need-that-command that turns out to be a lifesaver once or twice in a career.

]]></description>
			<content:encoded><![CDATA[<p>No mention of &#8216;tac&#8217;?</p>
<p>tac &#8211; concatenate and print files in reverse</p>
<p>Definitely a why-the-hell-would-anyone-need-that-command that turns out to be a lifesaver once or twice in a career.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
