<?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"
	>
<channel>
	<title>Comments on: Google SRE Question on Mass Changing File Extensions</title>
	<atom:link href="http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/</link>
	<description>stuff i'm working on</description>
	<pubDate>Sat, 22 Nov 2008 07:04:31 +0000</pubDate>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>By: Sven</title>
		<link>http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-200</link>
		<dc:creator>Sven</dc:creator>
		<pubDate>Fri, 21 Nov 2008 16:10:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-200</guid>
		<description>If you have a bash it's really easy (html-&#62;htm):

&lt;code&gt;
for i in *.html ; do mv $i ${i%.html}.htm ; done
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>If you have a bash it&#8217;s really easy (html-&gt;htm):</p>
<p><code><br />
for i in *.html ; do mv $i ${i%.html}.htm ; done<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Duncan Anderson</title>
		<link>http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-154</link>
		<dc:creator>Duncan Anderson</dc:creator>
		<pubDate>Wed, 30 Jul 2008 08:27:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-154</guid>
		<description>Jeff, 

That is brilliant. You have persuaded me to haul out "The AWK book" again. "sub" hmmm...

cheers
Duncan</description>
		<content:encoded><![CDATA[<p>Jeff, </p>
<p>That is brilliant. You have persuaded me to haul out &#8220;The AWK book&#8221; again. &#8220;sub&#8221; hmmm&#8230;</p>
<p>cheers<br />
Duncan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Schroeder</title>
		<link>http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-142</link>
		<dc:creator>Jeff Schroeder</dc:creator>
		<pubDate>Thu, 03 Jul 2008 12:54:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-142</guid>
		<description>With a bit of awk, you can beat everyone:

jeff@jschroeder2:/tmp/foo$ ls
file1.html  file2.html  file3.html  file4.html
jeff@jschroeder2:/tmp/foo$ ls &#124; awk '{printf("%s %s ", "mv", $1); sub(/\.html$/, ".htm"); print $1}' &#124; sh
jeff@jschroeder2:/tmp/foo$ ls
file1.htm  file2.htm  file3.htm  file4.htm
jeff@jschroeder2:/tmp/foo$ ls &#124; awk '{printf("%s %s ", "mv", $1); sub(/\.htm$/, ".html"); print $1}' &#124; sh
jeff@jschroeder2:/tmp/foo$ ls
file1.html  file2.html  file3.html  file4.html

http://www.digitalprognosis.com</description>
		<content:encoded><![CDATA[<p>With a bit of awk, you can beat everyone:</p>
<p>jeff@jschroeder2:/tmp/foo$ ls<br />
file1.html  file2.html  file3.html  file4.html<br />
jeff@jschroeder2:/tmp/foo$ ls | awk &#8216;{printf(&#8221;%s %s &#8220;, &#8220;mv&#8221;, $1); sub(/\.html$/, &#8220;.htm&#8221;); print $1}&#8217; | sh<br />
jeff@jschroeder2:/tmp/foo$ ls<br />
file1.htm  file2.htm  file3.htm  file4.htm<br />
jeff@jschroeder2:/tmp/foo$ ls | awk &#8216;{printf(&#8221;%s %s &#8220;, &#8220;mv&#8221;, $1); sub(/\.htm$/, &#8220;.html&#8221;); print $1}&#8217; | sh<br />
jeff@jschroeder2:/tmp/foo$ ls<br />
file1.html  file2.html  file3.html  file4.html</p>
<p><a href="http://www.digitalprognosis.com" rel="nofollow" onclick="javascript:urchinTracker ('/outbound/comment/www.digitalprognosis.com');">http://www.digitalprognosis.com</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Duncan Anderson</title>
		<link>http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-124</link>
		<dc:creator>Duncan Anderson</dc:creator>
		<pubDate>Tue, 27 May 2008 10:21:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-124</guid>
		<description>Oops. The usage is: changesuffix suffix1 suffix2
The posting mechanism devoured two pairs of lessthan and greaterthan signs which surrounded the strings "suffix1" and "suffix2", as well as the strings themselves.</description>
		<content:encoded><![CDATA[<p>Oops. The usage is: changesuffix suffix1 suffix2<br />
The posting mechanism devoured two pairs of lessthan and greaterthan signs which surrounded the strings &#8220;suffix1&#8243; and &#8220;suffix2&#8243;, as well as the strings themselves.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Duncan Anderson</title>
		<link>http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-123</link>
		<dc:creator>Duncan Anderson</dc:creator>
		<pubDate>Tue, 27 May 2008 10:05:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-123</guid>
		<description>When I posted the script "changesuffix", the process of posting it removed all of the indentation as well as the second half of the "Usage" line. What the hell is going on? That doesn't look anything like the script I wrote!</description>
		<content:encoded><![CDATA[<p>When I posted the script &#8220;changesuffix&#8221;, the process of posting it removed all of the indentation as well as the second half of the &#8220;Usage&#8221; line. What the hell is going on? That doesn&#8217;t look anything like the script I wrote!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Duncan Anderson</title>
		<link>http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-122</link>
		<dc:creator>Duncan Anderson</dc:creator>
		<pubDate>Tue, 27 May 2008 10:01:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-122</guid>
		<description>Here is a script which does not require anything other than a standard Bourne shell and awk. (This means it will work across many platforms.)I included some error trapping. This will work for any pair of suffixes.

if [ $# -ne 2 ]
then
        echo "Usage: changesuffix  "
        exit 1
else
        SUFFIX1=$1
        SUFFIX2=$2
        if [ "$SUFFIX1" = "$SUFFIX2" ]
        then
                echo "The suffixes must differ."
                exit 1
        fi
fi

if ls *.$SUFFIX1 &#62; /dev/null 2&#62; /dev/null
then
        :
else
        echo "There are no filenames with the suffix ."$SUFFIX1
        exit 1
fi

for FILE in *."$SUFFIX1"
do
        mv $FILE "`echo $FILE &#124; awk -F.$SUFFIX1 '{print $1}'`.$SUFFIX2"
done</description>
		<content:encoded><![CDATA[<p>Here is a script which does not require anything other than a standard Bourne shell and awk. (This means it will work across many platforms.)I included some error trapping. This will work for any pair of suffixes.</p>
<p>if [ $# -ne 2 ]<br />
then<br />
        echo &#8220;Usage: changesuffix  &#8221;<br />
        exit 1<br />
else<br />
        SUFFIX1=$1<br />
        SUFFIX2=$2<br />
        if [ "$SUFFIX1" = "$SUFFIX2" ]<br />
        then<br />
                echo &#8220;The suffixes must differ.&#8221;<br />
                exit 1<br />
        fi<br />
fi</p>
<p>if ls *.$SUFFIX1 &gt; /dev/null 2&gt; /dev/null<br />
then<br />
        :<br />
else<br />
        echo &#8220;There are no filenames with the suffix .&#8221;$SUFFIX1<br />
        exit 1<br />
fi</p>
<p>for FILE in *.&#8221;$SUFFIX1&#8243;<br />
do<br />
        mv $FILE &#8220;`echo $FILE | awk -F.$SUFFIX1 &#8216;{print $1}&#8217;`.$SUFFIX2&#8243;<br />
done</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carlos</title>
		<link>http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-116</link>
		<dc:creator>Carlos</dc:creator>
		<pubDate>Fri, 23 May 2008 00:58:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-116</guid>
		<description>Oh, forgot to close the quote in the htm used by basename.</description>
		<content:encoded><![CDATA[<p>Oh, forgot to close the quote in the htm used by basename.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carlos</title>
		<link>http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-115</link>
		<dc:creator>Carlos</dc:creator>
		<pubDate>Fri, 23 May 2008 00:57:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-115</guid>
		<description>Why does this looks so difficult? Try this: for i in *htm; do mv "$i" $(basename "$i" ".htm).html; done

Hope this helps.</description>
		<content:encoded><![CDATA[<p>Why does this looks so difficult? Try this: for i in *htm; do mv &#8220;$i&#8221; $(basename &#8220;$i&#8221; &#8220;.htm).html; done</p>
<p>Hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PL</title>
		<link>http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-114</link>
		<dc:creator>PL</dc:creator>
		<pubDate>Tue, 20 May 2008 00:25:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-114</guid>
		<description>And what about this:

#v+
for x in `ls *.htm`; do mv $x ${x}l; done
#v-

?</description>
		<content:encoded><![CDATA[<p>And what about this:</p>
<p>#v+<br />
for x in `ls *.htm`; do mv $x ${x}l; done<br />
#v-</p>
<p>?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cristian Gutierrez</title>
		<link>http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-108</link>
		<dc:creator>Cristian Gutierrez</dc:creator>
		<pubDate>Sat, 03 May 2008 07:40:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-108</guid>
		<description>Here you go.  If you get hired, you owe me a referral.


$ ls
a.html  b.html  c.htm  d.htm  e.html
$ perl -e 'for(@ARGV){/(.*htm)(l?)/;rename$_,$1.($2^"l")}' *
$ ls
a.htm  b.htm  c.html  d.html  e.htm
</description>
		<content:encoded><![CDATA[<p>Here you go.  If you get hired, you owe me a referral.</p>
<p>$ ls<br />
a.html  b.html  c.htm  d.htm  e.html<br />
$ perl -e &#8216;for(@ARGV){/(.*htm)(l?)/;rename$_,$1.($2^&#8221;l&#8221;)}&#8217; *<br />
$ ls<br />
a.htm  b.htm  c.html  d.html  e.htm</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-56</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Fri, 07 Mar 2008 07:10:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-56</guid>
		<description>Jarvis Talley's solution is totally wrong.</description>
		<content:encoded><![CDATA[<p>Jarvis Talley&#8217;s solution is totally wrong.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Glavin</title>
		<link>http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-46</link>
		<dc:creator>Kevin Glavin</dc:creator>
		<pubDate>Fri, 29 Feb 2008 01:18:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackmyidea.com/wordpress/2007/12/09/google-sre-question-on-mass-changing-file-extensions/#comment-46</guid>
		<description>Here it is in bash and this recurses down through the hierarchy, I cannot remember
if the "for" loop has a max number of elements so an xargs version might be more bulletproof, 

Kevin


cd target_dir
for a in `find . -type f -name "*.html"`; do  mv $a  ${a/html/htm}; done</description>
		<content:encoded><![CDATA[<p>Here it is in bash and this recurses down through the hierarchy, I cannot remember<br />
if the &#8220;for&#8221; loop has a max number of elements so an xargs version might be more bulletproof, </p>
<p>Kevin</p>
<p>cd target_dir<br />
for a in `find . -type f -name &#8220;*.html&#8221;`; do  mv $a  ${a/html/htm}; done</p>
]]></content:encoded>
	</item>
</channel>
</rss>
