<?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>Open Source Research and Development &#187; GREP Tools</title>
	<atom:link href="http://osrd.org/section/projects/grep/feed" rel="self" type="application/rss+xml" />
	<link>http://osrd.org</link>
	<description>Free and Open Source R&#38;D Projects, Articles, and Reviews</description>
	<lastBuildDate>Wed, 18 Feb 2009 03:54:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>how do i grep on a term with a $ in it such as $foo? i tried enclosing it in quotes but that doesn&#8217;t help</title>
		<link>http://osrd.org/projects/grep/grep-faq/how-do-i-grep-on-a-term-with-a-in-it-such-as-foo-i-tried-enclosing-it-in-quotes-but-that-doesnt-help</link>
		<comments>http://osrd.org/projects/grep/grep-faq/how-do-i-grep-on-a-term-with-a-in-it-such-as-foo-i-tried-enclosing-it-in-quotes-but-that-doesnt-help#comments</comments>
		<pubDate>Mon, 16 Feb 2009 04:57:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[grep FAQ]]></category>

		<guid isPermaLink="false">http://osrd.org/?p=31</guid>
		<description><![CDATA[Enclose the $ in square brackets [ .. ], that is, specify the special character as a character class. For example,
grep &#8216;[$]foo&#8217; file.txt
]]></description>
			<content:encoded><![CDATA[<p>Enclose the $ in square brackets [ .. ], that is, specify the special character as a character class. For example,</p>
<p>grep &#8216;[$]foo&#8217; file.txt</p>
]]></content:encoded>
			<wfw:commentRss>http://osrd.org/projects/grep/grep-faq/how-do-i-grep-on-a-term-with-a-in-it-such-as-foo-i-tried-enclosing-it-in-quotes-but-that-doesnt-help/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Negation in regular expressions</title>
		<link>http://osrd.org/projects/grep/negation-in-regular-expressions</link>
		<comments>http://osrd.org/projects/grep/negation-in-regular-expressions#comments</comments>
		<pubDate>Sat, 14 Feb 2009 04:41:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[GREP Tools]]></category>

		<guid isPermaLink="false">http://osrd.org/?p=27</guid>
		<description><![CDATA[How to search for lines that don&#8217;t contain a particular pattern is fairly easy in some programs, obscure in others, and almost impossible yet in others. That is, assuming your program of choice supports regular expressions. I review how to achieve this functionality in Perl, Vim, grep, and vi.

Regexp negation in Perl
Perl has many non-standard [...]]]></description>
			<content:encoded><![CDATA[<p>How to search for lines that don&#8217;t contain a particular pattern is fairly easy in some programs, obscure in others, and almost impossible yet in others. That is, assuming your program of choice supports regular expressions. I review how to achieve this functionality in Perl, Vim, grep, and vi.<br />
<span id="more-27"></span></p>
<h3>Regexp negation in Perl</h3>
<p>Perl has many non-standard features supported in the regular expression matching. One of these features in the lookahead <strong>(?pattern)</strong>. Furthermore, the lookahead function support negation <strong>(?!pattern)</strong>. To search in Perl for lines that contain <em><strong>foo</strong></em> but are not followed by <em><strong>bar</strong></em> anywhere on the line:</p>
<p><code>foo(?!.*bar)</code></p>
<h3>Regexp negation in Vim</h3>
<p>Vim&#8217;s regular expression matching is more flexible that vi&#8217;s. Particularly, vim supports the syntax <strong>@!</strong>. You can find a full description of this feature in vim by typing <strong>:help /@!.</strong> To search in Vim for lines that contain <em><strong>foo</strong></em> but are not followed by <em><strong>bar</strong></em> anywhere on the line:</p>
<p><code>foo(.*bar)@!</code></p>
<h3>Regexp in grep</h3>
<p>Grep doesn&#8217;t support negation of patterns in a regular expression, but it does support two other classes of negation: negation of character classes and negation of matches. Negation of character classes is standard in regular expression matching and the syntax is typically <strong>[^abc]</strong>, which mean match any character other than <em><strong>a</strong></em>, <em><strong>b</strong></em>, and <em><strong>c</strong></em>. Negation of matches is accomplished using the command line option <strong>-v</strong>. To search in grep for lines that contain <em><strong>foo</strong></em> but are not followed by <em><strong>bar</strong></em> anywhere on the line:</p>
<p><code>grep -o 'foo.*' file | grep -v 'bar'</code></p>
<p>Note that this works only in GNU grep and not the standard UNIX grep, because -o is a GNU grep extension that does not exist in UNIX grep.</p>
<h3>Regexp negation in vi, ed, and UNIX grep</h3>
<p>Basic regular expressions (BRE) and extended regular expressions (ERE) contain only one form of negation: character class negation. This makes it a lot more difficult to construct patterns that include pattern negation. But it is not impossible. One way to achieve this is to first construct a DFA for you pattern, write the formula&#8217;s describing the DFA, and then consolidate them into a regular expression. For simplicity, the example below is written in ERE. To search in ERE for lines that contain <em><strong>foo</strong></em> but are not followed by <em><strong>bar</strong></em> anywhere on the line:</p>
<p><code>foo([^b]|(b(b|(ab))*([^ba]|(a[^br]))))*((b(b|(ab))*a)|(b(b|(ab))*)|$)$</code></p>
<p>As demonstrated, although negation of pattern can be hard in plain regular expressions, it is not impossible as <a href="http://www.kleenecode.net/2008/10/10/regex-fu-not-followed-by/">some might think</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://osrd.org/projects/grep/negation-in-regular-expressions/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>if I wanted to match &#8216;foo13245&#8242;, can I use grep &#8216;foo[\d]*&#8217;?</title>
		<link>http://osrd.org/projects/grep/grep-faq/to-match-foo13245-can-i-use-grep-foo</link>
		<comments>http://osrd.org/projects/grep/grep-faq/to-match-foo13245-can-i-use-grep-foo#comments</comments>
		<pubDate>Wed, 07 Jan 2009 12:30:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[grep FAQ]]></category>

		<guid isPermaLink="false">http://osrd.org/?p=24</guid>
		<description><![CDATA[Nope, \d has no meaning (unless using -P for PCRE). You need [[:digit:]] instead; i.e.,
grep 'foo[[:digit:]]*'
]]></description>
			<content:encoded><![CDATA[<p>Nope, \d has no meaning (unless using -P for PCRE). You need [[:digit:]] instead; i.e.,</p>
<p><code>grep 'foo[[:digit:]]*'</code></p>
]]></content:encoded>
			<wfw:commentRss>http://osrd.org/projects/grep/grep-faq/to-match-foo13245-can-i-use-grep-foo/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How can i search for files which contain string A but not string B ?</title>
		<link>http://osrd.org/projects/grep/grep-faq/how-can-i-search-for-files-which-contain-string-a-but-not-string-b</link>
		<comments>http://osrd.org/projects/grep/grep-faq/how-can-i-search-for-files-which-contain-string-a-but-not-string-b#comments</comments>
		<pubDate>Tue, 06 Jan 2009 12:00:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[grep FAQ]]></category>

		<guid isPermaLink="false">http://osrd.org/?p=15</guid>
		<description><![CDATA[Pipe the output of grep through grep -v. For example:

grep 'A' file &#124; grep -v 'B'

]]></description>
			<content:encoded><![CDATA[<p>Pipe the output of grep through grep -v. For example:<br />
<code><br />
grep 'A' file | grep -v 'B'<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://osrd.org/projects/grep/grep-faq/how-can-i-search-for-files-which-contain-string-a-but-not-string-b/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why grep &#8216;foo&#124;bar&#8217; file doesn&#8217;t work?</title>
		<link>http://osrd.org/projects/grep/grep-faq/why-grep-foobar-file-doesnt-work</link>
		<comments>http://osrd.org/projects/grep/grep-faq/why-grep-foobar-file-doesnt-work#comments</comments>
		<pubDate>Mon, 05 Jan 2009 13:00:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[grep FAQ]]></category>

		<guid isPermaLink="false">http://osrd.org/?p=20</guid>
		<description><![CDATA[The bar &#124; has no special meaning in BRE (basic regular expressions). Use extended regular expressions (ERE) such as:
grep -E 'foo&#124;bar' file
or
egrep 'foo&#124;bar' file
In GNU grep, you can also force the spcial meaning of &#124; by escaping it. E.g.,
grep 'foo\&#124;bar' file
]]></description>
			<content:encoded><![CDATA[<p>The bar | has no special meaning in BRE (basic regular expressions). Use extended regular expressions (ERE) such as:</p>
<p><code>grep -E 'foo|bar' file</code></p>
<p><em>or</em></p>
<p><code>egrep 'foo|bar' file</code></p>
<p>In GNU grep, you can also force the spcial meaning of | by escaping it. E.g.,</p>
<p><code>grep 'foo\|bar' file</code></p>
]]></content:encoded>
			<wfw:commentRss>http://osrd.org/projects/grep/grep-faq/why-grep-foobar-file-doesnt-work/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is grep an acronym? Does it mean GNU Regular Expression P?</title>
		<link>http://osrd.org/projects/grep/grep-faq/is-grep-an-acronym-does-it-mean-gnu-regular-expression-p</link>
		<comments>http://osrd.org/projects/grep/grep-faq/is-grep-an-acronym-does-it-mean-gnu-regular-expression-p#comments</comments>
		<pubDate>Sun, 04 Jan 2009 20:32:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[grep FAQ]]></category>
		<category><![CDATA[GREP Tools]]></category>

		<guid isPermaLink="false">http://osrd.org/?p=12</guid>
		<description><![CDATA[grep originated from ed command: g/re/p where re is a regular expression, g stands for globally, and p stands for print. So one could say grep is an acronym of &#8220;Global Regular Expression Print&#8220;.
]]></description>
			<content:encoded><![CDATA[<p>grep originated from ed command: g/re/p where re is a regular expression, g stands for globally, and p stands for print. So one could say grep is an acronym of &#8220;<a title="Global Regular Expression Print Tools (grep variants)" href="projects/grep/global-regular-expression-print-tools-grep-variants">Global Regular Expression Print</a>&#8220;.</p>
]]></content:encoded>
			<wfw:commentRss>http://osrd.org/projects/grep/grep-faq/is-grep-an-acronym-does-it-mean-gnu-regular-expression-p/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Global Regular Expression Print Tools (grep variants)</title>
		<link>http://osrd.org/projects/grep/global-regular-expression-print-tools-grep-variants</link>
		<comments>http://osrd.org/projects/grep/global-regular-expression-print-tools-grep-variants#comments</comments>
		<pubDate>Tue, 26 Feb 2008 03:36:57 +0000</pubDate>
		<dc:creator>taa</dc:creator>
				<category><![CDATA[GREP Tools]]></category>

		<guid isPermaLink="false">http://osrd.eits.ca/blog/projects/grep/global-regular-expression-print-tools-grep-variants</guid>
		<description><![CDATA[Overview
The UNIX grep utility marked the birth of a global regular expression print (GREP) tools. Searching for patterns in text is important operation in a number of domains, including program comprehension and software maintenance, structured text databases, indexing file systems, and searching natural language texts. Such a wide range of uses inspired the development of [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Overview</strong><br />
The <a href="http://www.opengroup.org/onlinepubs/009695399/utilities/grep.html" title="The Open Group Base Specifications Issue 6">UNIX grep utility</a> marked the birth of a global regular expression print (GREP) tools. Searching for patterns in text is important operation in a number of domains, including program comprehension and software maintenance, structured text databases, indexing file systems, and searching natural language texts. Such a wide range of uses inspired the development of variations of the original UNIX grep. These variations range from adding new features, to employing faster algorithms, to changing the behaviour of pattern matching and printing.<br />
<span id="more-6"></span><br />
<strong>List of grep variants:</strong></p>
<ul>
<li>Approximate Grep: <a href="http://www.tgries.de/agrep/">agrep</a></li>
<li>Context grep: <a href="http://plg.uwaterloo.ca/%7Eftp/mt/cgrep/">cgrep</a></li>
<li>Structure grep: <a href="http://www.cs.helsinki.fi/u/jjaakkol/sgrep.html">sgrep</a></li>
<li>Nondeterministic reverse grep: <a href="http://www.dcc.uchile.cl/%7Egnavarro/software/">nr-grep</a></li>
<li>Grouse Grep: <a href="http://www.grouse.com.au/ggrep/">ggrep</a></li>
<li>GNU grep: <a href="http://www.gnu.org/software/grep/">grep</a></li>
<li>UNIX grep: <a href="http://www.opengroup.org/onlinepubs/009695399/utilities/grep.html">grep</a></li>
<li>Python Grep: <a href="http://www.vdesmedt.com/%7Evds2212/grep.html">grep.py</a></li>
<li>Multilingual Grep: <a href="http://www.ff.iij4u.or.jp/%7Enrt/lv/">lgrep</a></li>
<li>BSD-Licensed Grep: <a href="http://www.vocito.com/downloads/software/grep/">grep</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://osrd.org/projects/grep/global-regular-expression-print-tools-grep-variants/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
