<?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>NewPush &#187; sed</title> <atom:link href="http://newpush.com/tag/sed/feed/" rel="self" type="application/rss+xml" /><link>http://newpush.com</link> <description>Server Hosting, Data Warehouse Hosting, Collaboration</description> <lastBuildDate>Wed, 23 May 2012 03:47:03 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>How to change a link everywhere throughout one or multiple websites?</title><link>http://newpush.com/2009/05/how-to-change-a-link-everywhere-throughout-one-or-multiple-websites/</link> <comments>http://newpush.com/2009/05/how-to-change-a-link-everywhere-throughout-one-or-multiple-websites/#comments</comments> <pubDate>Sun, 31 May 2009 15:33:16 +0000</pubDate> <dc:creator>Balazs</dc:creator> <category><![CDATA[Perl]]></category> <category><![CDATA[sed]]></category><guid isPermaLink="false">http://www.wdream.com/?p=295</guid> <description><![CDATA[To do a recursive search and replace in a file system tree, the most effective way is to work directly on the file system. Using a tool like DreamWeaver is slow and cumbersome. Unix offers perl and find, which combined &#8230; <a href="http://newpush.com/2009/05/how-to-change-a-link-everywhere-throughout-one-or-multiple-websites/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p><span class="grey">To do a recursive search and replace in a file system tree, the most effective way is to work directly on the file system. Using a tool like DreamWeaver is slow and cumbersome. Unix offers perl and find, which combined allow to do a search and replace recursively very easily. This implmentation is in perl, but sed could also be used to achieve the same result.  At the prompt (with ssh or putty) go to the root of the tree you would like to modify, and type the following commands:</p><pre>
for i in `find . -name .html`

do

perl -p -i~ -e 's/original text/replacement text/g' "$i"

done</pre><p>The above shell script will cycle through all the subdirectories starting with the current directory and look for all .html files. &#8220;original text&#8221; can be any regular expression valid in perl.</span></p> ]]></content:encoded> <wfw:commentRss>http://newpush.com/2009/05/how-to-change-a-link-everywhere-throughout-one-or-multiple-websites/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Served from: newpush.com @ 2012-05-23 05:43:04 by W3 Total Cache -->
