<?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>Chris Schuld&#039;s Blog &#187; Regex</title>
	<atom:link href="http://chrisschuld.com/category/linux/regex/feed/" rel="self" type="application/rss+xml" />
	<link>http://chrisschuld.com</link>
	<description>personal musings on the composition of software</description>
	<lastBuildDate>Mon, 30 Aug 2010 03:48:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Search and Replace in Files</title>
		<link>http://chrisschuld.com/2008/01/search-and-replace-in-files/</link>
		<comments>http://chrisschuld.com/2008/01/search-and-replace-in-files/#comments</comments>
		<pubDate>Tue, 15 Jan 2008 01:36:46 +0000</pubDate>
		<dc:creator>Chris Schuld</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Regex]]></category>

		<guid isPermaLink="false">http://chrisschuld.com/2008/01/search-and-replace-in-files/</guid>
		<description><![CDATA[Here is how to do a search and replace using Perl regex over a set of files: perl -pi -e 's/source/destination/g' *.ext]]></description>
			<content:encoded><![CDATA[<p>Here is how to do a search and replace using Perl regex over a set of files:<br />
<br/><br/></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-pi</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/source/destination/g'</span> <span style="color: #000000; font-weight: bold;">*</span>.ext</pre></div></div>

<p><br/><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://chrisschuld.com/2008/01/search-and-replace-in-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parsing Out Specific Values In a Text File</title>
		<link>http://chrisschuld.com/2007/08/parsing-out-specific-values-in-a-text-file/</link>
		<comments>http://chrisschuld.com/2007/08/parsing-out-specific-values-in-a-text-file/#comments</comments>
		<pubDate>Thu, 09 Aug 2007 17:11:46 +0000</pubDate>
		<dc:creator>Chris Schuld</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Regex]]></category>

		<guid isPermaLink="false">http://chrisschuld.com/2007/08/parsing-out-specific-values-in-a-text-file/</guid>
		<description><![CDATA[Another task which hits my desk often is getting &#8220;data&#8221; out of text files. Such as names, email addresses, phone numbers, ID numbers, etc. Here is a quick way to parse or rip out &#8220;data&#8221; from a text file. I suggest using &#8216;grep&#8217; &#8212; grep is one of those applications which is more powerful than [...]]]></description>
			<content:encoded><![CDATA[<p>Another task which hits my desk often is getting &#8220;data&#8221; out of text files.  Such as names, email addresses, phone numbers, ID numbers, etc.  Here is a quick way to parse or rip out &#8220;data&#8221; from a text file.</p>
<p>I suggest using &#8216;grep&#8217; &#8212; grep is one of those applications which is more powerful than the casual user realizes.  And let&#8217;s face it, if you use or know what grep is you probably do not consider yourself a casual user.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-o</span> <span style="color: #660033;">-P</span> <span style="color: #ff0000;">&quot;[regex_pattern]&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>filename<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>The -o tells grep to only output what it matched in your pattern where your [regex_pattern] is your pattern.<br />
The -P tells grep to use Perl Regular Expressions</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisschuld.com/2007/08/parsing-out-specific-values-in-a-text-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Email Address Parsing</title>
		<link>http://chrisschuld.com/2007/07/email-address-parsing/</link>
		<comments>http://chrisschuld.com/2007/07/email-address-parsing/#comments</comments>
		<pubDate>Tue, 10 Jul 2007 19:05:00 +0000</pubDate>
		<dc:creator>Chris Schuld</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Regex]]></category>

		<guid isPermaLink="false">http://chrisschuld.com/2007/07/email-address-parsing/</guid>
		<description><![CDATA[Parsing out email addresses is a tedious task. This task hits my desk on a consistent basis. Usually, in my case, the list is coming out of Outlook. If the target list is coming out of Outlook make sure you export using Tab Separated for DOS (thus, click on File&#8211;>Import/Export&#8211;>Export to a File&#8211;>Tab Separated (DOS)&#8211;>[select_the_target_folder]). [...]]]></description>
			<content:encoded><![CDATA[<p>Parsing out email addresses is a tedious task.  This task  hits my desk on a consistent basis.  Usually, in my case, the list is coming out of Outlook.  If the target list is coming out of Outlook make sure you export using Tab Separated for DOS (thus, click on File&#8211;>Import/Export&#8211;>Export to a File&#8211;>Tab Separated (DOS)&#8211;>[select_the_target_folder]).  Take this target file and execute this command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>filename<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-o</span> <span style="color: #660033;">-P</span> <span style="color: #ff0000;">&quot;[[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(local|aero|coop|info|museum|name|([0-9]{ 1,3})|([a-zA-Z]{2,3}))]*&quot;</span></pre></div></div>

<p>Alternatively I usually need a list of unique addresses:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>filename<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-o</span> <span style="color: #660033;">-P</span> <span style="color: #ff0000;">&quot;[[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(local|aero|coop|info|museum|name|([0-9]{ 1,3})|([a-zA-Z]{2,3}))]*&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-u</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://chrisschuld.com/2007/07/email-address-parsing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
