<?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: Howto Replace multiple file text string in Linux</title>
	<atom:link href="http://www.debianadmin.com/howto-replace-multiple-file-text-string-in-linux.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.debianadmin.com/howto-replace-multiple-file-text-string-in-linux.html</link>
	<description>Debian/Ubuntu Linux System Administration Tutorials,Howtos,Tips</description>
	<lastBuildDate>Thu, 19 Nov 2009 13:24:32 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: J</title>
		<link>http://www.debianadmin.com/howto-replace-multiple-file-text-string-in-linux.html/comment-page-1#comment-4027</link>
		<dc:creator>J</dc:creator>
		<pubDate>Wed, 18 Nov 2009 17:22:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.debianadmin.com/howto-replace-multiple-file-text-string-in-linux.html#comment-4027</guid>
		<description>James&#039; solutions don&#039;t work if your directories have space in their names.</description>
		<content:encoded><![CDATA[<p>James&#8217; solutions don&#8217;t work if your directories have space in their names.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: afjal</title>
		<link>http://www.debianadmin.com/howto-replace-multiple-file-text-string-in-linux.html/comment-page-1#comment-3454</link>
		<dc:creator>afjal</dc:creator>
		<pubDate>Thu, 30 Jul 2009 20:46:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.debianadmin.com/howto-replace-multiple-file-text-string-in-linux.html#comment-3454</guid>
		<description>1. $grep -R –files-with-matches ‘OLDSTRING’ . &#124; sort &#124; uniq &#124; xargs perl -pi~ -e ’s/OLDSTRING/NEWSTRING/’


2. $ grep -rl OLDSTRING . &#124; xargs perl -pi~ -e ’s/OLDSTRING/NEWSTRING/’


I tried both the options, but no use, i am on Linux4 63 bit.

please let me know how to proceed !

Thanks to ALL</description>
		<content:encoded><![CDATA[<p>1. $grep -R –files-with-matches ‘OLDSTRING’ . | sort | uniq | xargs perl -pi~ -e ’s/OLDSTRING/NEWSTRING/’</p>
<p>2. $ grep -rl OLDSTRING . | xargs perl -pi~ -e ’s/OLDSTRING/NEWSTRING/’</p>
<p>I tried both the options, but no use, i am on Linux4 63 bit.</p>
<p>please let me know how to proceed !</p>
<p>Thanks to ALL</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eol</title>
		<link>http://www.debianadmin.com/howto-replace-multiple-file-text-string-in-linux.html/comment-page-1#comment-1842</link>
		<dc:creator>Eol</dc:creator>
		<pubDate>Tue, 12 Aug 2008 23:57:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.debianadmin.com/howto-replace-multiple-file-text-string-in-linux.html#comment-1842</guid>
		<description>James&#039;s solution works excellent for me
Thanks a lot!</description>
		<content:encoded><![CDATA[<p>James&#8217;s solution works excellent for me<br />
Thanks a lot!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.debianadmin.com/howto-replace-multiple-file-text-string-in-linux.html/comment-page-1#comment-1841</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Sat, 01 Sep 2007 22:56:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.debianadmin.com/howto-replace-multiple-file-text-string-in-linux.html#comment-1841</guid>
		<description>daniel:

You&#039;ll get that error if you copy and paste the line from your web browser because the single quote character that is pasted isn&#039;t the same that you would type.  Just delete the &#039;s from the command and type them back in manually.  Also, it appears that you might have an extra &#039; just before the //&#039; at the end of your command.

I used James&#039; version, retyping the single quotes, and it ran perfectly, thanks!</description>
		<content:encoded><![CDATA[<p>daniel:</p>
<p>You&#8217;ll get that error if you copy and paste the line from your web browser because the single quote character that is pasted isn&#8217;t the same that you would type.  Just delete the &#8217;s from the command and type them back in manually.  Also, it appears that you might have an extra &#8216; just before the //&#8217; at the end of your command.</p>
<p>I used James&#8217; version, retyping the single quotes, and it ran perfectly, thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: daniel</title>
		<link>http://www.debianadmin.com/howto-replace-multiple-file-text-string-in-linux.html/comment-page-1#comment-1840</link>
		<dc:creator>daniel</dc:creator>
		<pubDate>Wed, 29 Aug 2007 19:17:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.debianadmin.com/howto-replace-multiple-file-text-string-in-linux.html#comment-1840</guid>
		<description>In 1600 files want to replace the strings &quot;text: &quot; by nothing, so i give the command

$ grep -R -l &#039;text: &#039; . &#124; sort &#124; uniq &#124; xargs perl -pi~ -e &#039;s/text: &#039;//’

and then Ubuntu Feisty says
Unrecognized character \xE2 at -e line 1.
xargs: perl: exited with status 255; aborting

how to proceed?</description>
		<content:encoded><![CDATA[<p>In 1600 files want to replace the strings &#8220;text: &#8221; by nothing, so i give the command</p>
<p>$ grep -R -l &#8216;text: &#8216; . | sort | uniq | xargs perl -pi~ -e &#8217;s/text: &#8216;//’</p>
<p>and then Ubuntu Feisty says<br />
Unrecognized character \xE2 at -e line 1.<br />
xargs: perl: exited with status 255; aborting</p>
<p>how to proceed?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://www.debianadmin.com/howto-replace-multiple-file-text-string-in-linux.html/comment-page-1#comment-1839</link>
		<dc:creator>James</dc:creator>
		<pubDate>Mon, 13 Aug 2007 14:43:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.debianadmin.com/howto-replace-multiple-file-text-string-in-linux.html#comment-1839</guid>
		<description>Not sure why you run uniq on it, grep is perfectly capable of only returning unique results... And use the short options please. This should do just fine:

$ grep -rl OLDSTRING . &#124; xargs perl -pi~ -e &#039;s/OLDSTRING/NEWSTRING/&#039;

and if you want to do it sorted, files (this will even do unique results too!):

$ grep -rl OLDSTRING . &#124; sort -u &#124; xargs perl -pi~ -e &#039;s/OLDSTRING/NEWSTRING/&#039;

and for you old school sed peeps (sed args aren&#039;t as obscure):

$ grep -rl OLDSTRING . &#124; xargs sed -i -e &#039;s/OLDSTRING/NEWSTRING/&#039;

In all of these cases, you can replace the grep command with `find . -type f`. I&#039;m guessing this hasn&#039;t been performance tested. I&#039;m also guessing for large files, just running the search and replace would be faster than scanning the file for matches, then scanning the file for matches AND replacing them.</description>
		<content:encoded><![CDATA[<p>Not sure why you run uniq on it, grep is perfectly capable of only returning unique results&#8230; And use the short options please. This should do just fine:</p>
<p>$ grep -rl OLDSTRING . | xargs perl -pi~ -e &#8217;s/OLDSTRING/NEWSTRING/&#8217;</p>
<p>and if you want to do it sorted, files (this will even do unique results too!):</p>
<p>$ grep -rl OLDSTRING . | sort -u | xargs perl -pi~ -e &#8217;s/OLDSTRING/NEWSTRING/&#8217;</p>
<p>and for you old school sed peeps (sed args aren&#8217;t as obscure):</p>
<p>$ grep -rl OLDSTRING . | xargs sed -i -e &#8217;s/OLDSTRING/NEWSTRING/&#8217;</p>
<p>In all of these cases, you can replace the grep command with `find . -type f`. I&#8217;m guessing this hasn&#8217;t been performance tested. I&#8217;m also guessing for large files, just running the search and replace would be faster than scanning the file for matches, then scanning the file for matches AND replacing them.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
