<?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#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Function of the day: rgrep</title>
	<atom:link href="http://jorgebernal.info/2008/05/08/function-of-the-day-rgrep/feed/" rel="self" type="application/rss+xml" />
	<link>http://jorgebernal.info/2008/05/08/function-of-the-day-rgrep/</link>
	<description></description>
	<lastBuildDate>Sat, 17 Mar 2012 09:28:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Alexandre</title>
		<link>http://jorgebernal.info/2008/05/08/function-of-the-day-rgrep/#comment-314</link>
		<dc:creator><![CDATA[Alexandre]]></dc:creator>
		<pubDate>Sat, 10 May 2008 18:12:49 +0000</pubDate>
		<guid isPermaLink="false">http://koke.amedias.org/?p=182#comment-314</guid>
		<description><![CDATA[Your post makes me remember of my short helper that I uses all the time:

&lt;code&gt;
rg()
{
    filepat=&quot;$1&quot;
    pat=&quot;$2&quot;
    shift 2
    grep -Er --include=$filepat $pat ${@:-.}
}
# In Zsh, &#039;noglob&#039; turns off globing.
# (e.g, &quot;noglob echo *&quot; outputs &quot;*&quot;)
alias rg=&#039;noglob rg&#039;&lt;/code&gt;

It is lovely to use:

&lt;code&gt;
% rg *.c ^PyErr Lib/
% rg *.c PyErr_Restore . -C 10 &#124; less
% rg *.[ch] stringlib
% rg *.c ^[a-zA-Z]*_dealloc Modules/ Objects/&lt;/code&gt;]]></description>
		<content:encoded><![CDATA[<p>Your post makes me remember of my short helper that I uses all the time:</p>
<p><code><br />
rg()<br />
{<br />
    filepat="$1"<br />
    pat="$2"<br />
    shift 2<br />
    grep -Er --include=$filepat $pat ${@:-.}<br />
}<br />
# In Zsh, 'noglob' turns off globing.<br />
# (e.g, "noglob echo *" outputs "*")<br />
alias rg='noglob rg'</code></p>
<p>It is lovely to use:</p>
<p><code><br />
% rg *.c ^PyErr Lib/<br />
% rg *.c PyErr_Restore . -C 10 | less<br />
% rg *.[ch] stringlib<br />
% rg *.c ^[a-zA-Z]*_dealloc Modules/ Objects/</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ilmari Vacklin</title>
		<link>http://jorgebernal.info/2008/05/08/function-of-the-day-rgrep/#comment-313</link>
		<dc:creator><![CDATA[Ilmari Vacklin]]></dc:creator>
		<pubDate>Thu, 08 May 2008 20:11:38 +0000</pubDate>
		<guid isPermaLink="false">http://koke.amedias.org/?p=182#comment-313</guid>
		<description><![CDATA[I also recommend ack (see ).]]></description>
		<content:encoded><![CDATA[<p>I also recommend ack (see ).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wael Nasreddine</title>
		<link>http://jorgebernal.info/2008/05/08/function-of-the-day-rgrep/#comment-312</link>
		<dc:creator><![CDATA[Wael Nasreddine]]></dc:creator>
		<pubDate>Thu, 08 May 2008 18:44:42 +0000</pubDate>
		<guid isPermaLink="false">http://koke.amedias.org/?p=182#comment-312</guid>
		<description><![CDATA[There&#039;s always the perl script rgrep with prunes support... here&#039;s the script copied from &lt;a href=&quot;http://wael.nasreddine.com/cgi-bin/viewvc.cgi/wael/trunk/bin/rgrep?view=markup&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;

#!/usr/bin/perl -w
#
# vim:ft=perl:fenc=UTF-8:ts=4:sts=4:sw=4:expandtab:foldmethod=marker:foldlevel=0:
#
# $Id$
#
# originally by Michael Schwern

# Like grep -r except...
#   * you can leave off the directory and it will use . instead of waiting like
#     a dumbshit for STDIN
#   * It handles paths with spaces and quotes.
#   * it will not traverse into these directories or files.
my @Prunes = (qw(.svn CVS blib *~ *.bak _darcs imap_cachedir), &#039;#*&#039;);

my @Args = @ARGV;
my $Dir;
if( grep(!/^-/, @Args) &lt;= 1 ) {
        $Dir = &#039;.&#039;;
    }
else {
        $Dir = pop @Args;
    }

    @Args = map { &quot;&#039;$_&#039;&quot; }
            map { s/&#039;/&#039;&quot;&#039;&quot;&#039;/g; $_ } @Args;

            # Escape spaces and quotes
            $Dir =~ s{([ &#039;&quot;])}{\\$1}g;

            my $prunes = join &#039; -o &#039;, map { &quot;-name &#039;$_&#039; -prune&quot; } @Prunes;
            exec &quot;find $Dir $prunes -o -type f -print0 &#124; &quot;.
                 &quot;xargs -0 grep --color=auto @Args&quot;;]]></description>
		<content:encoded><![CDATA[<p>There&#8217;s always the perl script rgrep with prunes support&#8230; here&#8217;s the script copied from <a href="http://wael.nasreddine.com/cgi-bin/viewvc.cgi/wael/trunk/bin/rgrep?view=markup" rel="nofollow">here</a></p>
<p>#!/usr/bin/perl -w<br />
#<br />
# vim:ft=perl:fenc=UTF-8:ts=4:sts=4:sw=4:expandtab:foldmethod=marker:foldlevel=0:<br />
#<br />
# $Id$<br />
#<br />
# originally by Michael Schwern</p>
<p># Like grep -r except&#8230;<br />
#   * you can leave off the directory and it will use . instead of waiting like<br />
#     a dumbshit for STDIN<br />
#   * It handles paths with spaces and quotes.<br />
#   * it will not traverse into these directories or files.<br />
my @Prunes = (qw(.svn CVS blib *~ *.bak _darcs imap_cachedir), &#8216;#*&#8217;);</p>
<p>my @Args = @ARGV;<br />
my $Dir;<br />
if( grep(!/^-/, @Args) &lt;= 1 ) {<br />
        $Dir = &#8216;.&#8217;;<br />
    }<br />
else {<br />
        $Dir = pop @Args;<br />
    }</p>
<p>    @Args = map { &#8220;&#8216;$_&#8217;&#8221; }<br />
            map { s/&#8217;/'&#8221;&#8216;&#8221;&#8216;/g; $_ } @Args;</p>
<p>            # Escape spaces and quotes<br />
            $Dir =~ s{([ '"])}{\\$1}g;</p>
<p>            my $prunes = join &#8216; -o &#8216;, map { &#8220;-name &#8216;$_&#8217; -prune&#8221; } @Prunes;<br />
            exec &#8220;find $Dir $prunes -o -type f -print0 | &#8220;.<br />
                 &#8220;xargs -0 grep &#8211;color=auto @Args&#8221;;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tormod</title>
		<link>http://jorgebernal.info/2008/05/08/function-of-the-day-rgrep/#comment-311</link>
		<dc:creator><![CDATA[Tormod]]></dc:creator>
		<pubDate>Thu, 08 May 2008 15:00:55 +0000</pubDate>
		<guid isPermaLink="false">http://koke.amedias.org/?p=182#comment-311</guid>
		<description><![CDATA[The name rgrep is already used by /usr/bin/rgrep. You can also use an alias, which has a few advantages:
 alias grepr=&quot;grep -rin&quot;]]></description>
		<content:encoded><![CDATA[<p>The name rgrep is already used by /usr/bin/rgrep. You can also use an alias, which has a few advantages:<br />
 alias grepr=&#8221;grep -rin&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: salty-horse</title>
		<link>http://jorgebernal.info/2008/05/08/function-of-the-day-rgrep/#comment-310</link>
		<dc:creator><![CDATA[salty-horse]]></dc:creator>
		<pubDate>Thu, 08 May 2008 14:48:22 +0000</pubDate>
		<guid isPermaLink="false">http://koke.amedias.org/?p=182#comment-310</guid>
		<description><![CDATA[Have you tried ack?

It&#039;s designed to replace most of grep&#039;s usecases.
It can search recursively in source code files, skipping directories like .svn.

You&#039;ll never need to hack grep scripts again :)]]></description>
		<content:encoded><![CDATA[<p>Have you tried ack?</p>
<p>It&#8217;s designed to replace most of grep&#8217;s usecases.<br />
It can search recursively in source code files, skipping directories like .svn.</p>
<p>You&#8217;ll never need to hack grep scripts again <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hads</title>
		<link>http://jorgebernal.info/2008/05/08/function-of-the-day-rgrep/#comment-309</link>
		<dc:creator><![CDATA[hads]]></dc:creator>
		<pubDate>Thu, 08 May 2008 10:53:39 +0000</pubDate>
		<guid isPermaLink="false">http://koke.amedias.org/?p=182#comment-309</guid>
		<description><![CDATA[I like to throw and -I in there as well which is useful when grepping against directories with binaries in it.]]></description>
		<content:encoded><![CDATA[<p>I like to throw and -I in there as well which is useful when grepping against directories with binaries in it.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

