<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>&#60;SourceBench/&#62; Your place to share code stuff &#187; grep</title>
	<atom:link href="http://sourcebench.com/tag/grep/feed/" rel="self" type="application/rss+xml" />
	<link>http://sourcebench.com</link>
	<description></description>
	<lastBuildDate>Tue, 04 May 2010 07:57:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Ack is better than grep! &#8211; And it&#8217;s not only their slogan.</title>
		<link>http://sourcebench.com/post/ack-is-better-than-grep-and-its-not-only-their-slogan/</link>
		<comments>http://sourcebench.com/post/ack-is-better-than-grep-and-its-not-only-their-slogan/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 20:14:49 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[Blog posts]]></category>
		<category><![CDATA[ack]]></category>
		<category><![CDATA[Bash/shell]]></category>
		<category><![CDATA[grep]]></category>

		<guid isPermaLink="false">http://sourcebench.com/post/ack-is-better-than-grep-and-its-not-only-their-slogan/</guid>
		<description><![CDATA[I recently was pointed to ack for scanning a huge pile of files for a certain pattern. So far I was always using grep, awk, cut, sed and such in combination with find to build whatever I needed. But having a look at ack reveals that my life could have been much easier. Here are [...]]]></description>
			<content:encoded><![CDATA[<p>I recently was pointed to <a href="http://betterthangrep.com/">ack</a> for scanning a huge pile of files for a certain pattern. So far I was always using grep, awk, cut, sed and such in combination with find to build whatever I needed. But having a look at ack reveals that my life could have been much easier. Here are some simple examples:</p>
<p>Search for a pattern recursively through directories, while ignoring .svn, CVS and other VCS directories:<br />
With grep: <code>grep pattern $(find . -type f | grep -v '\.svn')</code><br />
With ack: <code>ack pattern</code></p>
<p>Search for a pattern in all perl files, while ignoring .svn directories:<br />
With grep: <code>grep pattern $(find . -name '*.pl' -or -name '*.pm' -or -name '*.pod' | grep -v .svn)</code><br />
With ack: <code>ack --perl pattern</code></p>
<p>That&#8217;s it for the basics. More on their manual page at <a href="http://betterthangrep.com/" rel="nofollow">http://betterthangrep.com/</a></p>
<p>Just a last one:<br />
Get a list of all functions and their parameters attached to your &#8220;wp_head&#8221; action hook of a WordPress installation.<br />
With grep: please don&#8217;t make me do it.<br />
With ack: <code>ack "add_action\((.*[\"|'](.*)[\"|'][,|\s]+.*)\)" --output="hook: \$1, params: \$2"</code></p>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/post/ack-is-better-than-grep-and-its-not-only-their-slogan/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Get a list of urls/domains from a text file</title>
		<link>http://sourcebench.com/languages/bash/get-a-list-of-urlsdomains-from-a-text-file/</link>
		<comments>http://sourcebench.com/languages/bash/get-a-list-of-urlsdomains-from-a-text-file/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 23:05:54 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[Bash/shell]]></category>
		<category><![CDATA[domains]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[urls]]></category>

		<guid isPermaLink="false">http://sourcebench.com/languages/bash/get-a-list-of-urlsdomains-from-a-text-file/</guid>
		<description><![CDATA[sed 's/http/\^http/g' FILENAME &#124; tr -s &#34;^&#34; &#34;\n&#34; &#124; grep http&#124; sed 's/[\ &#124;\\\&#124;\&#34;].*//g' &#124; sed &#34;s/['].*//g&#34; &#124; sort &#124; uniq]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash;">sed 's/http/\^http/g' FILENAME | tr -s &quot;^&quot; &quot;\n&quot; | grep http| sed 's/[\ |\\\|\&quot;].*//g' | sed &quot;s/['].*//g&quot; | sort | uniq</pre>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/languages/bash/get-a-list-of-urlsdomains-from-a-text-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Search for a function definition in a bunch of php files</title>
		<link>http://sourcebench.com/languages/bash/search-for-a-function-definition-in-a-bunch-of-php-files/</link>
		<comments>http://sourcebench.com/languages/bash/search-for-a-function-definition-in-a-bunch-of-php-files/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 13:40:08 +0000</pubDate>
		<dc:creator>The SourceBench</dc:creator>
				<category><![CDATA[Bash/shell]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://sourcebench.com/languages/bash/search-for-a-function-definition-in-a-bunch-of-php-files/</guid>
		<description><![CDATA[find . -name *.php -exec grep -HE &#34;function FUNCTION_NAME&#34; {} \;]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash;">find . -name *.php -exec grep -HE &quot;function FUNCTION_NAME&quot; {} \;</pre>]]></content:encoded>
			<wfw:commentRss>http://sourcebench.com/languages/bash/search-for-a-function-definition-in-a-bunch-of-php-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
