<?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>The Number 42 &#187; Bash/Shell</title>
	<atom:link href="http://www.thenumber42.net/category/computer-stuff/programming/bashshell/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thenumber42.net</link>
	<description>Mostly about software testing, but a little bit about life, the universe, and everything</description>
	<lastBuildDate>Wed, 31 Mar 2010 01:52:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Turning a Multi-Line File Into a CSV File</title>
		<link>http://www.thenumber42.net/2008/04/10/turning-a-multi-line-file-into-a-csv-file/</link>
		<comments>http://www.thenumber42.net/2008/04/10/turning-a-multi-line-file-into-a-csv-file/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 23:07:33 +0000</pubDate>
		<dc:creator>Isaac</dc:creator>
				<category><![CDATA[Bash/Shell]]></category>
		<category><![CDATA[linux utilities csv]]></category>

		<guid isPermaLink="false">http://www.thenumber42.net/?p=95</guid>
		<description><![CDATA[Linux has many amazing programs that can be chained together to produce amazing results.  Today I needed to turn a multi-line file into a CSV (comma separated) file.  In Linux this is super easy:
cat file &#124; tr '\n' ','
Basically, this will turn a file like this:
Line1
Line2
Line3
Line4
Into this:
Line1,Line2,Line3,Line4

]]></description>
			<content:encoded><![CDATA[<p>Linux has many amazing programs that can be chained together to produce amazing results.  Today I needed to turn a multi-line file into a CSV (comma separated) file.  In Linux this is super easy:</p>
<pre class="bash"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #c20cb9; font-weight: bold;">file</span> | <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span> <span style="color: #ff0000;">','</span></pre>
<p>Basically, this will turn a file like this:</p>
<pre>Line1
Line2
Line3
Line4</pre>
<p>Into this:</p>
<pre>Line1,Line2,Line3,Line4
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.thenumber42.net/2008/04/10/turning-a-multi-line-file-into-a-csv-file/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Recursive Find and Replace in Linux</title>
		<link>http://www.thenumber42.net/2006/09/25/recursive-find-and-replace-in-linux/</link>
		<comments>http://www.thenumber42.net/2006/09/25/recursive-find-and-replace-in-linux/#comments</comments>
		<pubDate>Mon, 25 Sep 2006 18:53:00 +0000</pubDate>
		<dc:creator>Isaac</dc:creator>
				<category><![CDATA[Bash/Shell]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[replace]]></category>

		<guid isPermaLink="false">http://www.thenumber42.net/2006/09/25/recursive-find-and-replace-in-linux/</guid>
		<description><![CDATA[Believe it or not this actually took some time to find, so I am posting it here for future reference.  To do a find and replace recursively in Linux type:
&#160;
find ./ -type f &#124; xargs sed -i 's/string1/string2/g'
&#160;
That will replace every occurrence of "string1" with "string2."
]]></description>
			<content:encoded><![CDATA[<p>Believe it or not this actually took some time to find, so I am posting it here for future reference.  To do a find and replace recursively in Linux type:</p>
<pre class="bash">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">find</span> ./ -<span style="color: #7a0874; font-weight: bold;">type</span> f | <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> -i <span style="color: #ff0000;">'s/string1/string2/g'</span>
&nbsp;</pre>
<p>That will replace every occurrence of "string1" with "string2."</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thenumber42.net/2006/09/25/recursive-find-and-replace-in-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bash Variables</title>
		<link>http://www.thenumber42.net/2006/08/17/bash-variables/</link>
		<comments>http://www.thenumber42.net/2006/08/17/bash-variables/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<dc:creator>Isaac</dc:creator>
				<category><![CDATA[Bash/Shell]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://www.thenumber42.net/2006/08/17/bash-variables/</guid>
		<description><![CDATA[

Character
Definition
$*
Expands to the positional parameters, starting from one.  When the expansion occurs within double quotes, it expands to a single word with the value of each parameter separated by the first character of the IFS special variable.


$@
Expands to the positional parameters, starting from one.  When the expansion occurs within double quotes, each parameter [...]]]></description>
			<content:encoded><![CDATA[<table border="1">
<thead>
<th align="left" valign="middle">Character</th>
<th align="left" valign="middle">Definition</th>
<td align="left" valign="middle"><tt>$*</tt></td>
<td align="left" valign="middle">Expands to the positional parameters, starting from one.  When the expansion occurs within double quotes, it expands to a single word with the value of each parameter separated by the first character of the <tt>IFS</tt> special variable.</td>
</tr>
<tr>
<td align="left" valign="middle"><tt>$@</tt></td>
<td align="left" valign="middle">Expands to the positional parameters, starting from one.  When the expansion occurs within double quotes, each parameter expands to a separate word.</td>
</tr>
<tr>
<td align="left" valign="middle"><tt>$#</tt></td>
<td align="left" valign="middle">Expands to the number of positional parameters in decimal.</td>
</tr>
<tr>
<td align="left" valign="middle"><tt>$?</tt></td>
<td align="left" valign="middle">Expands to the exit status of the most recently executed foreground pipeline.</td>
</tr>
<tr>
<td align="left" valign="middle"><tt>$-</tt></td>
<td align="left" valign="middle">A hyphen expands to the current option flags as specified upon invocation, by the <strong>set</strong> built-in command, or those set by the shell itself (such as the <tt>-i</tt>).</td>
</tr>
<tr>
<td align="left" valign="middle"><tt>$$</tt></td>
<td align="left" valign="middle">Expands to the process ID of the shell.</td>
</tr>
<tr>
<td align="left" valign="middle"><tt>$!</tt></td>
<td align="left" valign="middle">Expands to the process ID of the most recently executed background (asynchronous) command.</td>
</tr>
<tr>
<td align="left" valign="middle"><tt>$0</tt></td>
<td align="left" valign="middle">Expands to the name of the shell or shell script.</td>
</tr>
<tr>
<td align="left" valign="middle"><tt>$_</tt></td>
<td align="left" valign="middle">The underscore variable is set at shell startup and contains the absolute file name of the shell or script being executed as passed in the argument list.  Subsequently, it expands to the last argument to the previous command, after expansion.  It is also set to the full pathname of each command executed and placed in the environment exported to that command.  When checking mail, this parameter holds the name of the mail file.</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.thenumber42.net/2006/08/17/bash-variables/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using find in Linux</title>
		<link>http://www.thenumber42.net/2006/08/11/using-find-in-linux/</link>
		<comments>http://www.thenumber42.net/2006/08/11/using-find-in-linux/#comments</comments>
		<pubDate>Fri, 11 Aug 2006 22:05:00 +0000</pubDate>
		<dc:creator>Isaac</dc:creator>
				<category><![CDATA[Bash/Shell]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[find]]></category>

		<guid isPermaLink="false">http://www.thenumber42.net/2006/08/11/using-find-in-linux/</guid>
		<description><![CDATA[The find command is Linux is seriously cool.  It allows you to do so much more than simply locate where a file lives.  You can also do nifty stuff like delete all the temporary files on your whole hard drive, find broken links, delete empty files, search within files, and more.  You [...]]]></description>
			<content:encoded><![CDATA[<p>The <span style="font-family: courier new">find</span> command is Linux is seriously cool.  It allows you to do so much more than simply locate where a file lives.  You can also do nifty stuff like delete all the temporary files on your whole hard drive, find broken links, delete empty files, search within files, and more.  You can read about a small fraction of what's possible <a href="http://www-128.ibm.com/developerworks/eserver/library/es-unix-find.html?ca=dgr-lnxw16FindIt">here</a>.</p>
<div class="link-summarizer">Link Summary
<ul>
<li><a href='http://www-128.ibm.com/developerworks/eserver/library/es-unix-find.html?ca=dgr-lnxw16FindIt'>http://www-128.ibm.co...l?ca=dgr-lnxw16FindIt</a></li>
</ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.thenumber42.net/2006/08/11/using-find-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mounting a remote SSH filesystem</title>
		<link>http://www.thenumber42.net/2006/06/05/mounting-a-remote-ssh-filesystem/</link>
		<comments>http://www.thenumber42.net/2006/06/05/mounting-a-remote-ssh-filesystem/#comments</comments>
		<pubDate>Mon, 05 Jun 2006 21:09:00 +0000</pubDate>
		<dc:creator>Isaac</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Bash/Shell]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mount]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[sshfs]]></category>

		<guid isPermaLink="false">http://www.thenumber42.net/2006/06/05/mounting-a-remote-ssh-filesystem/</guid>
		<description><![CDATA[On a typical project there are many different computers that I must use.  For years I have been using scp to copy files from one computer to another and wishing for a way to just mount the SSH filesystem.  Well, my wish finally came true!
The good news is that thanks to sshfs I [...]]]></description>
			<content:encoded><![CDATA[<p>On a typical project there are many different computers that I must use.  For years I have been using <span style="font-family: courier new">scp</span> to copy files from one computer to another and wishing for a way to just mount the SSH filesystem.  Well, my wish finally came true!</p>
<p>The good news is that thanks to <a href="http://fuse.sourceforge.net/sshfs.html">sshfs </a>I can now mount all of my remote directories to local mount points.  The better news is that any normal user (meaning non-root user) can mount a SSH filesystem.  The best news?  Only the client side needs any special software installed.  The server side is just a normal ssh daemon.  The only catch?  The root user must install sshfs on the client machine.</p>
<p>SSHFS relies on a project called <a href="http://fuse.sourceforge.net/">FUSE</a> to be installed first.  FUSE is a library to create filesystem that can be mounted in userspace.  There are many projects based off this project including some filesystems that can mount a compressed file to a normal filesystem.  Navigate on over to <a href="http://fuse.sourceforge.net/">http://fuse.sourceforge.net</a> and download the latest.  After extracting the files from the tarball, run the following:</p>
<pre class="bash">&nbsp;
./configure
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>   <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">as</span> root<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre>
<p>Once FUSE is installed then download and install sshfs doing:</p>
<pre class="bash">&nbsp;
./configure
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>  <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">as</span> root<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre>
<p>Now, as an ordinary user you can just mount a ssh filesystem by doing:</p>
<pre class="bash">&nbsp;
sshfs <span id="emob-hfreanzr@ubfg.gung.unf.svyr-43">username {at} host.that.has(.)file</span><script type="text/javascript">
    var mailNode = document.getElementById('emob-hfreanzr@ubfg.gung.unf.svyr-43');
    var linkNode = document.createElement('a');
    linkNode.setAttribute('href', "mailto:%75%73%65%72%6E%61%6D%65%40%68%6F%73%74%2E%74%68%61%74%2E%68%61%73%2E%66%69%6C%65");
    tNode = document.createTextNode("username {at} host.that.has(.)file");
    linkNode.appendChild(tNode);
    linkNode.setAttribute('id', "emob-hfreanzr@ubfg.gung.unf.svyr-43");
    mailNode.parentNode.replaceChild(linkNode, mailNode);
</script>system: mountpoint</pre>
<p>That's it!  The mounted directory can now be used just like any ordinary directory.  Already the discovery of this great tool has saved my fingers from typing unnecessary scp commands.  I love it!</p>
<p>Once you are finished with the mount you can unmount it by doing:</p>
<pre class="bash">&nbsp;
fusermount -u mountpoint</pre>
<p>Happy SSH'ing!</p>
<div class="link-summarizer">Link Summary
<ul>
<li><a href='http://fuse.sourceforge.net/sshfs.html'>http://fuse.sourceforge.net/sshfs.html</a></li><li><a href='http://fuse.sourceforge.net/'>http://fuse.sourceforge.net/</a></li>
</ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.thenumber42.net/2006/06/05/mounting-a-remote-ssh-filesystem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
