<?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/"
		>
<channel>
	<title>Comments on: Search and Replace Recursively using sed and grep</title>
	<atom:link href="http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep</link>
	<description>Nirav Mehta on life, technology and future</description>
	<lastBuildDate>Sun, 14 Mar 2010 02:18:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Hugo Magalhães</title>
		<link>http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/comment-page-1#comment-133347</link>
		<dc:creator>Hugo Magalhães</dc:creator>
		<pubDate>Fri, 12 Feb 2010 16:11:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/#comment-133347</guid>
		<description>You can avoid the creation of a temporary file using -i option for sed:

  1 #!/bin/sh
  2 grep -rl $2 $1 &#124;
  3  while read filename
  4  do
  5  (
  6   echo $filename
  7   sed -i &quot;s/$2/$3/g;&quot; $filename
  8  )
  9   done

Regards,</description>
		<content:encoded><![CDATA[<p>You can avoid the creation of a temporary file using -i option for sed:</p>
<p>  1 #!/bin/sh<br />
  2 grep -rl $2 $1 |<br />
  3  while read filename<br />
  4  do<br />
  5  (<br />
  6   echo $filename<br />
  7   sed -i &#8220;s/$2/$3/g;&#8221; $filename<br />
  8  )<br />
  9   done</p>
<p>Regards,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Antonio</title>
		<link>http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/comment-page-1#comment-133260</link>
		<dc:creator>Antonio</dc:creator>
		<pubDate>Sat, 05 Dec 2009 15:44:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/#comment-133260</guid>
		<description>A small improvement:
Change

mv $filename.xx $filename

by

cp $filename.xx $filename
rm $filename.xx

and original file permissions will be preserved</description>
		<content:encoded><![CDATA[<p>A small improvement:<br />
Change</p>
<p>mv $filename.xx $filename</p>
<p>by</p>
<p>cp $filename.xx $filename<br />
rm $filename.xx</p>
<p>and original file permissions will be preserved</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Delete recursively lines from files that match a given string @ Timur Asaliev</title>
		<link>http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/comment-page-1#comment-133251</link>
		<dc:creator>Delete recursively lines from files that match a given string @ Timur Asaliev</dc:creator>
		<pubDate>Mon, 30 Nov 2009 13:22:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/#comment-133251</guid>
		<description>[...] used: www.mehtanirav.com www.cs.mcgill.ca   Projects, [...]</description>
		<content:encoded><![CDATA[<p>[...] used: <a href="http://www.mehtanirav.com" rel="nofollow">http://www.mehtanirav.com</a> <a href="http://www.cs.mcgill.ca" rel="nofollow">http://www.cs.mcgill.ca</a>   Projects, [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trestini</title>
		<link>http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/comment-page-1#comment-132806</link>
		<dc:creator>Trestini</dc:creator>
		<pubDate>Mon, 02 Mar 2009 18:01:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/#comment-132806</guid>
		<description>sed -i &#039;s/oldText/newText/g&#039; `grep -ril &#039;oldText&#039; *` works fine for me</description>
		<content:encoded><![CDATA[<p>sed -i &#8217;s/oldText/newText/g&#8217; `grep -ril &#8216;oldText&#8217; *` works fine for me</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rookie</title>
		<link>http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/comment-page-1#comment-132569</link>
		<dc:creator>Rookie</dc:creator>
		<pubDate>Fri, 05 Sep 2008 13:02:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/#comment-132569</guid>
		<description>For whole words, update line 7:
sed &quot;s/\b$2\b/$3/g;&quot; $filename&gt; $filename.xx</description>
		<content:encoded><![CDATA[<p>For whole words, update line 7:<br />
sed &#8220;s/\b$2\b/$3/g;&#8221; $filename&gt; $filename.xx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ezequiel</title>
		<link>http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/comment-page-1#comment-132558</link>
		<dc:creator>ezequiel</dc:creator>
		<pubDate>Tue, 02 Sep 2008 04:52:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/#comment-132558</guid>
		<description>I haven&#039;t ever seen a better file than this.  It solved me days of work, you are gorgeous.  

I NEVER write comments to posts because I don&#039;t have time, but this time I have 4 working-days of free credit that you have just saved me with this file.

Thanks. ezequiel.</description>
		<content:encoded><![CDATA[<p>I haven&#8217;t ever seen a better file than this.  It solved me days of work, you are gorgeous.  </p>
<p>I NEVER write comments to posts because I don&#8217;t have time, but this time I have 4 working-days of free credit that you have just saved me with this file.</p>
<p>Thanks. ezequiel.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leonardo</title>
		<link>http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/comment-page-1#comment-132340</link>
		<dc:creator>Leonardo</dc:creator>
		<pubDate>Wed, 25 Jun 2008 18:00:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/#comment-132340</guid>
		<description>for i in `find` ;  do sed &quot;s/pattern/replacement/g&quot; &quot;$i&quot; &gt;&gt; &quot;$i.xx&quot;; mv &quot;$i.xx&quot; &quot;$i&quot;; done

I don&#039;t know if this work in mac.</description>
		<content:encoded><![CDATA[<p>for i in `find` ;  do sed &#8220;s/pattern/replacement/g&#8221; &#8220;$i&#8221; &gt;&gt; &#8220;$i.xx&#8221;; mv &#8220;$i.xx&#8221; &#8220;$i&#8221;; done</p>
<p>I don&#8217;t know if this work in mac.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nirav</title>
		<link>http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/comment-page-1#comment-115712</link>
		<dc:creator>Nirav</dc:creator>
		<pubDate>Fri, 04 Jan 2008 03:50:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/#comment-115712</guid>
		<description>BTW, Manish has a way to &lt;a href=&quot;http://mannu.livejournal.com/406783.html&quot; rel=&quot;nofollow&quot;&gt;do this using Perl - http://mannu.livejournal.com/406783.html&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>BTW, Manish has a way to <a href="http://mannu.livejournal.com/406783.html" rel="nofollow">do this using Perl &#8211; </a><a href="http://mannu.livejournal.com/406783.html" rel="nofollow">http://mannu.livejournal.com/406783.html</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nirav</title>
		<link>http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/comment-page-1#comment-115711</link>
		<dc:creator>Nirav</dc:creator>
		<pubDate>Fri, 04 Jan 2008 03:50:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/#comment-115711</guid>
		<description>The exec part here: wouldn&#039;t it fork a new process for every file? Is that a good practice? I thought otherwise!</description>
		<content:encoded><![CDATA[<p>The exec part here: wouldn&#8217;t it fork a new process for every file? Is that a good practice? I thought otherwise!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: t3rmin4t0r</title>
		<link>http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/comment-page-1#comment-114378</link>
		<dc:creator>t3rmin4t0r</dc:creator>
		<pubDate>Mon, 31 Dec 2007 01:04:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.mehtanirav.com/2007/12/29/search-and-replace-recursively-using-sed-and-grep/#comment-114378</guid>
		<description>find containingFolder/ -type f -exec sed -i~ &quot;s/oldText/newText/g&quot; {} \;</description>
		<content:encoded><![CDATA[<p>find containingFolder/ -type f -exec sed -i~ &#8220;s/oldText/newText/g&#8221; {} \;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
