<?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>tail -f /dev/null &#187; variable</title>
	<atom:link href="http://tfdn.radiofreeomaha.net/tag/variable/feed/" rel="self" type="application/rss+xml" />
	<link>http://tfdn.radiofreeomaha.net</link>
	<description>Tips, notes, HOWTOs</description>
	<lastBuildDate>Fri, 20 Aug 2010 04:13:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Simple Vim Macros</title>
		<link>http://tfdn.radiofreeomaha.net/2009/11/simple-vim-macros/</link>
		<comments>http://tfdn.radiofreeomaha.net/2009/11/simple-vim-macros/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 18:27:29 +0000</pubDate>
		<dc:creator>Uncle Jubba</dc:creator>
				<category><![CDATA[CLI]]></category>
		<category><![CDATA[Config]]></category>
		<category><![CDATA[vi]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[replace]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[variable]]></category>

		<guid isPermaLink="false">http://tfdn.radiofreeomaha.net/?p=96</guid>
		<description><![CDATA[I found myself editing a configuration file (multiple actually) at work today and ran into an issue.  The config file looked similar to: Var_1=A Var_2=B Var_3=C ... Var_146=ABC Var_147=ABD As it happened I needed to remove one of the lines at position 23.  The program that reads/uses these config files has an issue if there [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<p>I found myself editing a configuration file (multiple actually) at work today and ran into an issue.  The config file looked similar to:</p>
<pre class="brush: bash">
Var_1=A
Var_2=B
Var_3=C
...
Var_146=ABC
Var_147=ABD
</pre>
<p>As it happened I needed to remove one of the lines at position 23.  The program that reads/uses these config files has an issue if there is a break in the sequence.  So after removing the line with &#8220;Var_23&#8243; I needed to shift all of the numbers in following lines down by 1.  Here is how I accomplished that.</p>
<p>In vim I put my cursor on the 24 in the line that now follows the &#8220;Var_22&#8243; line and performed the following commands:</p>
<pre class="brush: bash">
qa
CTRL-X
j
q
125@a
</pre>
<p>Here is what happened broken down by line:</p>
<p>1: Here I am recording a macro (q) with the name or identifier of &#8216;a&#8217;.  Note you will probably see some indication in the last line that you are in &#8220;recording&#8221; mode.</p>
<p>2: CTRL-X decrements the number under the cursor.  Since I am on the 24 that decrements it to 23.</p>
<p>3:  I move down 1 line and now the cursor is on the 25 in the next line.</p>
<p>4: I quit recording the macro.  I know have a named (a) macro that includes the commands &#8220;decrement the number under the cursor and move down one row&#8221;.</p>
<p>5: I perform that named (a) macro 125 times.  Now realistically I only needed to do it 123 times.  It didn&#8217;t seem to matter that I used 125 but YMMV.  The first line after the last line I wanted to change was a blank line so I assume the macro quit when the CTRL-X failed.  You are probably better off using the exact number.</p>
<p>And there you have it.  I successfully renumbered all of the variables below the line I deleted to be in sequence.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/pixy.gif?x-id=9ec0d12e-548c-44ca-8cc8-0f9543ba456a" alt="" /><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://tfdn.radiofreeomaha.net/2009/11/simple-vim-macros/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remembering The Shell&#8217;s Special Variables</title>
		<link>http://tfdn.radiofreeomaha.net/2008/12/remembering-the-shells-special-variables/</link>
		<comments>http://tfdn.radiofreeomaha.net/2008/12/remembering-the-shells-special-variables/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 21:44:00 +0000</pubDate>
		<dc:creator>Uncle Jubba</dc:creator>
				<category><![CDATA[CLI]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[echo]]></category>
		<category><![CDATA[parameter]]></category>
		<category><![CDATA[variable]]></category>

		<guid isPermaLink="false">http://tfdn.radiofreeomaha.net/?p=45</guid>
		<description><![CDATA[I can never seem to remember what all of these default parameter variables are.  I found this small shell script that prints them out when I forget. #!/bin/sh -vx ####################################################### # example_1.1 (c) R.H.Reepe 1996 March 28 Version 1.0 # ####################################################### echo &#34;Script name is [$0]&#34; echo &#34;First Parameter is [$1]&#34; echo &#34;Second Parameter is [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<p>I can never seem to remember what all of these default parameter variables are.  I found this small shell script that prints them out when I forget.</p>
<pre>
<pre class="brush: bash">#!/bin/sh -vx
#######################################################
# example_1.1 (c) R.H.Reepe 1996 March 28 Version 1.0 #
#######################################################
echo &quot;Script name is            [$0]&quot;
echo &quot;First Parameter is                [$1]&quot;
echo &quot;Second Parameter is               [$2]&quot;
echo &quot;This Process ID is                [$$]&quot;
echo &quot;This Parameter Count is   [$#]&quot;
echo &quot;All Parameters            [$@]&quot;
echo &quot;The FLAGS are                     [$-]&quot;</pre>
<p>It produces output like this:</p>
<pre>
<pre class="brush: bash">#!/bin/sh -vx
#######################################################
# example_1.1 (c) R.H.Reepe 1996 March 28 Version 1.0 #
#######################################################
echo &quot;Script name is            [$0]&quot;
+ echo &#039;Script name is            [/home/me/bin/shellhelp]&#039;
Script name is            [/home/me/bin/shellhelp]
echo &quot;First Parameter is                [$1]&quot;
+ echo &#039;First Parameter is                []&#039;
First Parameter is                []
echo &quot;Second Parameter is               [$2]&quot;
+ echo &#039;Second Parameter is               []&#039;
Second Parameter is               []
echo &quot;This Process ID is                [$$]&quot;
+ echo &#039;This Process ID is                [15190]&#039;
This Process ID is                [15190]
echo &quot;This Parameter Count is   [$#]&quot;
+ echo &#039;This Parameter Count is   [0]&#039;
This Parameter Count is   [0]
echo &quot;All Parameters            [$@]&quot;
+ echo &#039;All Parameters            []&#039;
All Parameters            []
echo &quot;The FLAGS are                     [$-]&quot;
+ echo &#039;The FLAGS are                     [hvxB]&#039;
The FLAGS are                     [hvxB]</pre>
<p>via <a href="http://www.injunea.demon.co.uk/pages/page204.htm" target="_blank">Richard&#8217;s Unix Shell Scripting Universe</a></p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://tfdn.radiofreeomaha.net/2008/12/remembering-the-shells-special-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

