<?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>Bjørges hjørne &#187; Koding</title>
	<atom:link href="http://flisespikker.no/category/norsk/koding/feed/" rel="self" type="application/rss+xml" />
	<link>http://flisespikker.no</link>
	<description>i en flisespikkers verden</description>
	<lastBuildDate>Sun, 17 Jul 2011 20:50:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>fjerne norske tegn</title>
		<link>http://flisespikker.no/2009/12/18/fjerne-norske-tegn/</link>
		<comments>http://flisespikker.no/2009/12/18/fjerne-norske-tegn/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 10:12:08 +0000</pubDate>
		<dc:creator>Bjørge Solli</dc:creator>
				<category><![CDATA[Koding]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[kode]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[synkronisering]]></category>
		<category><![CDATA[unison]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://flisespikker.no/?p=115</guid>
		<description><![CDATA[Hvordan konvertere norske tegn i filnavn og kataloger til ikke-norske tegn. bash-skript.]]></description>
			<content:encoded><![CDATA[<p>Jeg synkroniserer filer mellom Windows, Linux og OSX med <a href="http://www.cis.upenn.edu/~bcpierce/unison/">Unison</a>. Unisons utvikler sier siste versjon skal takle forskjellige tegnsett, men jeg fikk alikevel problemer med norske tegn. L&oslash;sningen var for meg &aring; fjerne alle norske tegn i filnavn og katalognavn i mappen jeg synkroniserer. For &aring; gj&oslash;re dette laget jeg et lite bash-skript. Dette m&aring; kj&oslash;res p&aring; Linux eller OSX, evt. under cygwin p&aring; Windows. Koden f&oslash;lger under.</p>
<pre>
<code>
#!/bin/bash

[ $? -ne 1 ] || { echo "usage: $0 &lt;dir&gt;"; exit 1; }

[ -d $1 ] || { echo "usage: $0 &lt;dir&gt;"; exit 2; }

which find &amp;&gt;/dev/null || { echo "could not find command 'find'"; exit 3; }
which egrep &amp;&gt;/dev/null || { echo "could not find command 'egrep'"; exit 4; }
which sed &amp;&gt;/dev/null || { echo "could not find command 'sed'"; exit 5; }

redo=1
until [ $redo -eq 0 ]; do
  redo=0
  find $1 -type d -print | \
  while read dir; do
    echo "$dir" | egrep -qi '&aelig;|&oslash;|&aring;' &amp;&amp; {
      newdir=`echo "$dir" | sed -e 's/&aelig;/ae/g' -e 's/&oslash;/o/g' -e 's/&aring;/aa/g' -e 's/&AElig;/AE/g' -e 's/&Oslash;/O/g' -e 's/&Aring;/AA/g'`
      mv -v "$dir" "$newdir" 2&gt;/dev/null || redo=1
    }
  done
  find $1 -type f -print | \
  while read fn; do
    echo "$fn" | egrep -qi '&aelig;|&oslash;|&aring;' &amp;&amp; {
      newfn=`echo "$fn" | sed -e 's/&aelig;/ae/g' -e 's/&oslash;/o/g' -e 's/&aring;/aa/g' -e 's/&AElig;/AE/g' -e 's/&Oslash;/O/g' -e 's/&Aring;/AA/g'`
      mv -v "$fn" "$newfn" 2&gt;/dev/null || redo=1
    }
  done
done
</code>
</pre>
<p>Husk at du m&aring; gj&oslash;re filen kj&oslash;rbar med kommandoen</p>
<p><code>chmod u+x filnavn</code></p>
]]></content:encoded>
			<wfw:commentRss>http://flisespikker.no/2009/12/18/fjerne-norske-tegn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

