<?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>John&#039;s Blog &#187; bash</title>
	<atom:link href="http://john.nachtimwald.com/tag/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://john.nachtimwald.com</link>
	<description>My little blog</description>
	<lastBuildDate>Sat, 31 Jul 2010 17:28:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Multiple Input with Single Input Apps</title>
		<link>http://john.nachtimwald.com/2008/12/24/multiple-input-with-single-input-apps/</link>
		<comments>http://john.nachtimwald.com/2008/12/24/multiple-input-with-single-input-apps/#comments</comments>
		<pubDate>Wed, 24 Dec 2008 23:36:42 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[ebook]]></category>

		<guid isPermaLink="false">http://john.nachtimwald.com/?p=61</guid>
		<description><![CDATA[The few eBook formating tools I&#8217;ve posted all share one major flaw. They can only handle a single file as input. This is a problem when you want to run it on all or a number of different eBooks. If you are able to use Bash there is a simple way to run any single [...]]]></description>
			<content:encoded><![CDATA[<p>The few eBook formating tools I&#8217;ve posted all share one major flaw. They can only handle a single file as input. This is a problem when you want to run it on all or a number of different eBooks. If you are able to use Bash there is a simple way to run any single input command with multiple items.</p>
<p>This first method gets input from a single directory. This method will not go into subdirectories for input.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>Books<span style="color: #000000; font-weight: bold;">/</span>author
$ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-1</span> <span style="color: #000000; font-weight: bold;">*</span>.txt <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> <span style="color: #c20cb9; font-weight: bold;">file</span>; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$file</span>; .<span style="color: #000000; font-weight: bold;">/</span>fix_paragraphs_ebook_txt <span style="color: #ff0000;">&quot;<span style="color: #007800;">$file</span>&quot;</span>; .<span style="color: #000000; font-weight: bold;">/</span>remove_extra_whitespace_ebook_txt <span style="color: #ff0000;">&quot;<span style="color: #007800;">$file</span>&quot;</span>; <span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>This second method gets all files matching the given pattern and will handle subdirectories.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">find</span> ~<span style="color: #000000; font-weight: bold;">/</span>books<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-iname</span> <span style="color: #ff0000;">&quot;*.txt&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> <span style="color: #c20cb9; font-weight: bold;">file</span>; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$file</span>&quot;</span>; dos2unix <span style="color: #660033;">-ad</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$file</span>&quot;</span>; .<span style="color: #000000; font-weight: bold;">/</span>fix_end_ebook_txt <span style="color: #ff0000;">&quot;<span style="color: #007800;">$file</span>&quot;</span>; <span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://john.nachtimwald.com/2008/12/24/multiple-input-with-single-input-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
