<?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>Pario TechnoBlob &#187; xargs</title>
	<atom:link href="http://pario.no/tag/xargs/feed/" rel="self" type="application/rss+xml" />
	<link>http://pario.no</link>
	<description>A cronological documentation test project, nothing serious, really!</description>
	<lastBuildDate>Thu, 26 Apr 2012 08:18:54 +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>Howto remove orphan packages in Ubuntu</title>
		<link>http://pario.no/2010/05/12/howto-remove-orphan-packages-in-ubuntu/</link>
		<comments>http://pario.no/2010/05/12/howto-remove-orphan-packages-in-ubuntu/#comments</comments>
		<pubDate>Wed, 12 May 2010 10:23:29 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[aptitude]]></category>
		<category><![CDATA[deborphan]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ubuntu hardy]]></category>
		<category><![CDATA[xargs]]></category>

		<guid isPermaLink="false">http://pario.no/?p=1333</guid>
		<description><![CDATA[There is usually some orphan packages left on the system after upgrading Ubuntu from one major version to another. These packages can cause strange errors like Ubuntu bug #151045. The solution to this problem is a package named deborphan. deborphan removes orphan packages that are left on your Ubuntu installation and you should run this [...]]]></description>
			<content:encoded><![CDATA[<p>There is usually some orphan packages left on the system after upgrading Ubuntu from one major version to another. These packages can cause strange errors like Ubuntu bug <a href="https://bugs.launchpad.net/ubuntu/+source/libxml2/+bug/151045">#151045</a>. The solution to this problem is a package named deborphan. deborphan removes orphan packages that are left on your Ubuntu installation and you should run this program after any major Ubuntu upgrade.</p>
<p><strong>Install and run deborphan</strong></p>
<pre># sudo aptitude install deborphan
# sudo deborphan</pre>
<p><strong>Result</strong></p>
<pre>liblzo1
libdb4.3
libsasl2</pre>
<p>These files were listed on one of my Ubuntu 8.04 installations. This installation had been upgraded from a previous LTS version.</p>
<p>All we have to do now is to remove those orphaned packages</p>
<pre># sudo deborphan | xargs sudo aptitude purge -y</pre>
<p>This howto has not been tested on a Debian distribution, but I guess it will work there also.</p>
<script type="text/javascript">var wordpress_toolbar_urls = ["https:\/\/bugs.launchpad.net\/ubuntu\/+source\/libxml2\/+bug\/151045"];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMTAvMDUvMTIvaG93dG8tcmVtb3ZlLW9ycGhhbi1wYWNrYWdlcy1pbi11YnVudHUvPHdwdGI%2BSG93dG8gcmVtb3ZlIG9ycGhhbiBwYWNrYWdlcyBpbiBVYnVudHU8d3B0Yj5odHRwOi8vcGFyaW8ubm88d3B0Yj5QYXJpbyBUZWNobm9CbG9i";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2010/05/12/howto-remove-orphan-packages-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Strip the kernel to contain only needed modules</title>
		<link>http://pario.no/2007/12/04/strip-the-kernel-to-contain-only-needed-modules/</link>
		<comments>http://pario.no/2007/12/04/strip-the-kernel-to-contain-only-needed-modules/#comments</comments>
		<pubDate>Tue, 04 Dec 2007 14:38:45 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cut]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[lsmod]]></category>
		<category><![CDATA[modinfo]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[xargs]]></category>

		<guid isPermaLink="false">http://pario.no/2007/12/04/strip-the-kernel-to-contain-only-needed-modules/</guid>
		<description><![CDATA[This is a great page with som nice bash scripts describing how to remove unwanted modules from your kernel.]]></description>
			<content:encoded><![CDATA[<p>This is a great page with som nice bash scripts describing <a href="http://wiki.linuxquestions.org/wiki/Configuring_linux_kernel">how to remove unwanted modules from your kernel</a>.</p>
<script type="text/javascript">var wordpress_toolbar_urls = ["http:\/\/wiki.linuxquestions.org\/wiki\/Configuring_linux_kernel"];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMTIvMDQvc3RyaXAtdGhlLWtlcm5lbC10by1jb250YWluLW9ubHktbmVlZGVkLW1vZHVsZXMvPHdwdGI%2BU3RyaXAgdGhlIGtlcm5lbCB0byBjb250YWluIG9ubHkgbmVlZGVkIG1vZHVsZXM8d3B0Yj5odHRwOi8vcGFyaW8ubm88d3B0Yj5QYXJpbyBUZWNobm9CbG9i";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/12/04/strip-the-kernel-to-contain-only-needed-modules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Courier-IMAP to Dovecot Migration Script</title>
		<link>http://pario.no/2007/05/17/courier-imap-to-dovecot-migration-script/</link>
		<comments>http://pario.no/2007/05/17/courier-imap-to-dovecot-migration-script/#comments</comments>
		<pubDate>Thu, 17 May 2007 20:49:59 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Courier-imap]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Dovecot]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[maildir]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[RedHat]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[xargs]]></category>

		<guid isPermaLink="false">http://hhj.no/wordpress/2007/05/17/courier-imap-to-dovecot-migration-script/</guid>
		<description><![CDATA[I’ve just migrated a couple of servers from Courier-IMAP to Dovecot, and am very happy with the latter so far. I thought I’d share the courier2dovecot shell script I whipped together (based on the instructions I found in the migration how-to), for converting Courier-IMAP maildirs to Dovecot format. While the script is rather simple, it [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve just migrated a couple of servers from Courier-IMAP to <a href="http://www.dovecot.org/">Dovecot</a>, and am very happy with the latter so far. I thought I’d share the <strong>courier2dovecot </strong> shell script I whipped together (based on the instructions I found in the <a href="http://wiki.dovecot.org/">migration how-to</a>), for converting Courier-IMAP <a href="http://en.wikipedia.org/wiki/Maildir">maildirs</a> to Dovecot format.</p>
<p>While the script is rather simple, it can save a fair bit of typing when migrating some hundreds of mail accounts, especially since Courier stores some of its own state files recursively in each folder of the maildir hierarchy, making it a real pain to otherwise manually rename or remove all of them.</p>
<p>Here’s a plain-English summary of what the script currently does, when given a Courier maildir path as an argument:</p>
<ul>
<li>Check that the given path is indeed a valid Courier maildir, and exit if not.</li>
<li>Rename the file ‘courierimapsubscribed’ to ‘subscriptions’, and strip the ‘INBOX.’ prefix from its contents.</li>
<li>Recursively rename all of files of the name ‘courierimapuiddb’ to ‘dovecot-uidlist’.</li>
<li>Recursively delete all of files of the name ‘courierimaphieracl’, ‘courierimapacl’ and ‘courierimapkeywords’.</li>
</ul>
<p>The script will also verbosely print out each action it performs, handy for redirecting the output to a log file for a large migration.</p>
<p>Hopefully people about to jump ship from Courier to Dovecot find this useful. If anyone comes up with improvements to the script, please send them my way.</p>
<pre>
#!/bin/sh
#
# courier2dovecot -- Converts a Courier maildir to Dovecot format.
# Copyright (c) 2005 Arto Bendiken. Released under the GNU GPL.
# Newest version available from http://bendiken.net/scripts/
#
# 2005-10-21 initial version for Dovecot 1.0.
#
dir="$1"
if [ -z "$dir" ] || [ "$dir" = "-?" ] || [ "$dir" = "-h" ] || [ "$dir" = "--help" ]; then
  echo "Usage: $0 maildirpath"
  exit 1
fi
if [ ! -d "$dir" ] || [ ! -e "$dir/courierimapsubscribed" ]; then
  echo "$dir is not a path to a Courier maildir"
  exit 1
fi
find $dir -name courierimapsubscribed -print0 | xargs -0r rename -v 's/courierimapsubscribed/subscriptions/'
find $dir -name subscriptions -print0 | xargs -0r sed -i 's/INBOX\.//'
find $dir -name courierimapuiddb -print0 | xargs -0r rename -v 's/courierimapuiddb/dovecot-uidlist/'
find $dir -name courierimaphieracl -print0 | xargs -0r rm -vrf
find $dir -name courierimapacl -print0 | xargs -0r rm -vf
find $dir -name courierimapkeywords -print0 | xargs -0r rm -vrf</pre>
<p><strong>Comment to the script:</strong><br />
Hey Arto &amp; everyone using this script:</p>
<p>Be careful when trying to run this on <strong>Red Hat Enterprise Linux</strong> or <strong>CentOS 4</strong> systems. These operating systems ship with a different rename command than the Debian systems. You can also tell them apart based on the output when running ‘rename’ with no arguments.</p>
<p>This is the perl version which works:<br />
<code>Usage: rename [-v] [-n] [-f] perlexpr [filenames]</code></p>
<p>This is the RHEL/CentOS version that doesn’t:<br />
<code>call: rename.orig from to files…</code></p>
<p>Hope this helps someone out there, and thanks for the script Arto!</p>
<p>Source: <a href="http://bendiken.net/2005/11/03/courier-imap-to-dovecot-migration-script">http://bendiken.net/2005/11/03/courier-imap-to-dovecot-migration-script</a></p>
<script type="text/javascript">var wordpress_toolbar_urls = ["http:\/\/www.dovecot.org\/","http:\/\/wiki.dovecot.org\/","http:\/\/en.wikipedia.org\/wiki\/Maildir","http:\/\/bendiken.net\/2005\/11\/03\/courier-imap-to-dovecot-migration-script"];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMDUvMTcvY291cmllci1pbWFwLXRvLWRvdmVjb3QtbWlncmF0aW9uLXNjcmlwdC88d3B0Yj5Db3VyaWVyLUlNQVAgdG8gRG92ZWNvdCBNaWdyYXRpb24gU2NyaXB0PHdwdGI%2BaHR0cDovL3BhcmlvLm5vPHdwdGI%2BUGFyaW8gVGVjaG5vQmxvYg%3D%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/05/17/courier-imap-to-dovecot-migration-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shell script for removing duplicate files</title>
		<link>http://pario.no/2007/05/15/shell-script-for-removing-duplicate-files/</link>
		<comments>http://pario.no/2007/05/15/shell-script-for-removing-duplicate-files/#comments</comments>
		<pubDate>Tue, 15 May 2007 06:41:43 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[JPG]]></category>
		<category><![CDATA[md5]]></category>
		<category><![CDATA[md5sum]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[sort]]></category>
		<category><![CDATA[uniq]]></category>
		<category><![CDATA[xargs]]></category>

		<guid isPermaLink="false">http://hhj.no/wordpress/2007/05/15/shell-script-for-removing-duplicate-files/</guid>
		<description><![CDATA[The following shell script finds duplicate (2 or more identical) files and outputs a new shell script containing commented-out rm statements for deleting them. You then have to edit the file to select which files to keep &#8211; the script can&#8217;t safely do it automatically! OUTF=rem-duplicates.sh; echo "#! /bin/sh" &#62; $OUTF; find "$@" -type f [...]]]></description>
			<content:encoded><![CDATA[<p>The following shell script finds duplicate (2 or more identical) files and outputs a new shell script containing commented-out rm statements for deleting them.<br />
You then have to edit the file to select which files to keep &#8211; the script can&#8217;t safely do it automatically!</p>
<pre>
OUTF=rem-duplicates.sh;
echo "#! /bin/sh" &gt; $OUTF;
find "$@" -type f -print0 |
  xargs -0 -n1 md5sum |
    sort --key=1,32 | uniq -w 32 -d --all-repeated=separate |
    sed -r 's/^[0-9a-f]*( )*//;s/([^a-zA-Z0-9./_-])/\\\1/g;s/(.+)/#rm \1/' &gt;&gt; $OUTF;
chmod a+x $OUTF; ls -l $OUTF</pre>
<p>Example output (rem-duplicates.sh)</p>
<pre>
#! /bin/sh
#rm ./gdc2001/113-1303_IMG.JPG
#rm ./reppulilta/gdc2001/113-1303_IMG.JPG

#rm ./lissabon/01-01-2001/108-0883_IMG.JPG
#rm ./kuvat\ reppulilta/lissabon/01-01-2001/108-0883_IMG.JPG

#rm ./gdc2001/113-1328_IMG.JPG
#rm ./kuvat\ reppulilta/gdc2001/113-1328_IMG.JPG</pre>
<p><strong>Explanation</strong></p>
<ol>
<li>write output script header</li>
<li>list all files recursively under current directory</li>
<li>escape all the potentially dangerous characters with xargs</li>
<li>calculate MD5 sums</li>
<li>find duplicate sums</li>
<li>strip off MD5 sums and leave only file names</li>
<li>escape strange characters from the filenames</li>
<li>write out commented-out delete commands</li>
<li>make the output script writable and ls -l it</li>
</ol>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMDUvMTUvc2hlbGwtc2NyaXB0LWZvci1yZW1vdmluZy1kdXBsaWNhdGUtZmlsZXMvPHdwdGI%2BU2hlbGwgc2NyaXB0IGZvciByZW1vdmluZyBkdXBsaWNhdGUgZmlsZXM8d3B0Yj5odHRwOi8vcGFyaW8ubm88d3B0Yj5QYXJpbyBUZWNobm9CbG9i";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/05/15/shell-script-for-removing-duplicate-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find all web pages that reference to www.example.com</title>
		<link>http://pario.no/2007/05/07/find-all-web-pages-that-reference-to-wwwexamplecom/</link>
		<comments>http://pario.no/2007/05/07/find-all-web-pages-that-reference-to-wwwexamplecom/#comments</comments>
		<pubDate>Mon, 07 May 2007 11:15:26 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[xargs]]></category>

		<guid isPermaLink="false">http://hhj.no/wordpress/2007/05/07/find-all-web-pages-that-reference-to-wwwexamplecom/</guid>
		<description><![CDATA[find / -name '*html' -print \ &#124; xargs grep -l 'www.example.com' \ &#124; less -Opages]]></description>
			<content:encoded><![CDATA[<pre>
find / -name '*html' -print \
  | xargs grep -l 'www.example.com' \
  | less -Opages</pre>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMDUvMDcvZmluZC1hbGwtd2ViLXBhZ2VzLXRoYXQtcmVmZXJlbmNlLXRvLXd3d2V4YW1wbGVjb20vPHdwdGI%2BRmluZCBhbGwgd2ViIHBhZ2VzIHRoYXQgcmVmZXJlbmNlIHRvIHd3dy5leGFtcGxlLmNvbTx3cHRiPmh0dHA6Ly9wYXJpby5ubzx3cHRiPlBhcmlvIFRlY2hub0Jsb2I%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/05/07/find-all-web-pages-that-reference-to-wwwexamplecom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

