<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Matching on Amit Agarwal Linux Blog</title>
    <link>/tags/matching/</link>
    <description>Recent content in Matching on Amit Agarwal Linux Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Wed, 27 Jan 2010 07:45:45 +0000</lastBuildDate>
    
	<atom:link href="/tags/matching/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Quickly search and replace string with Regular expression in multiple files using perl</title>
      <link>/2010/01/27/quickly-search-and-replace-string-with-regular-expression-in-multiple-files-using-perl/</link>
      <pubDate>Wed, 27 Jan 2010 07:45:45 +0000</pubDate>
      
      <guid>/2010/01/27/quickly-search-and-replace-string-with-regular-expression-in-multiple-files-using-perl/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;blockquote&gt;
&lt;p&gt;for i in *; do perl -p -w -e &amp;amp;#8217;s/a(.*)b.*/d$1e/g&amp;amp;#8217;  $i &amp;gt; temp/$i; done&lt;/p&gt;
&lt;p&gt;for i in *; do perl -pi -w -e &amp;amp;#8217;s/a(.*)b.*/d$1e/g&amp;amp;#8217;  $i ; done&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The first one can be used when you want to preserve the original file. The redirection will cause the file with replaced string to be written to the new location in the temp directory. Modify the same according to your needs.&lt;/p&gt;
&lt;p&gt;The second can be used to modify the files in-line. Causing overwriting the original file.&lt;/p&gt;</description>
    </item>
    
  </channel>
</rss>
