<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule">

<channel>
<title>Make variables uppercase in bash. in All Things Unix</title>
<link>http://www.dslreports.com/forum/r21458754</link>
<description></description>
<language>en</language>
<pubDate>Sun, 06 Dec 2009 03:17:11 EDT</pubDate>
<lastBuildDate>Sun, 06 Dec 2009 03:17:11 EDT</lastBuildDate>

<item>
<title>Re: Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21463312</link>
<description><![CDATA[<A HREF="/useremail/u/698757"><b>nixen</b></A> : <div class="bquote"><small>said by  Maxo <A HREF="/useremail/u/715380"><IMG SRC="http://i.dslr.net/bb/profile.gif" ALT="See Profile" BORDER=0 WIDTH=16 HEIGHT=11></A> :</small><br><br>I've never used sed before and have only recently began reading up on regular expressions.<br>I read through the man pages and looked at the code you gave.  It appears to work with the following code:<br><textarea name="code" class="text" cols=50 rows=10>echo $LINE | sed 's/o\./O\./g' | sed 's/i\./I\./g'&#012;</textarea><!--end code block--><br>The only thing that is missing is how to take the result of this output and store it in a variable.<br><br> </div><textarea name="code" class="text" cols=50 rows=10>VAR=`$LINE | sed -e 's/o\./O\./g' -e 's/i\./I\./g'`&#012;</textarea><!--end code block--><br>Or even:<br><textarea name="code" class="text" cols=50 rows=10>VAR=`$LINE | sed '{&#012;                     s/o\./O\./g&#012;                     s/i\./I\./g&#012;                  }'`&#012;</textarea><!--end code block--><small>--<br>The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt. -- Bertrand Russell</small><br>]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21463312</guid>
<pubDate>Fri, 21 Nov 2008 12:53:46 EDT</pubDate>
</item>

<item>
<title>Re: Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21463055</link>
<description><![CDATA[<A HREF="/useremail/u/0"><b>anon</b></A> : Glad to help Maxo.  Feel free to ask for help anytime you get stuck.]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21463055</guid>
<pubDate>Fri, 21 Nov 2008 12:05:23 EDT</pubDate>
</item>

<item>
<title>Re: Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21462022</link>
<description><![CDATA[<A HREF="/useremail/u/715380"><b>Maxo</b></A> : <div class="bquote"><small>said by Sir Meowmix III :</small><br><br>[code]<br>MYVAR=$(echo $LINE | sed 's/o\./O\./g' | sed 's/i\./I\./g')<br> <br>echo $MYVAR<br>[/code]<br> </div>That did it.  Thanks a lot.  You can probably tell that we just started learning how to write these scripts a few weeks ago.]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21462022</guid>
<pubDate>Fri, 21 Nov 2008 09:17:42 EDT</pubDate>
</item>

<item>
<title>Re: Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21461897</link>
<description><![CDATA[<A HREF="/useremail/u/0"><b>anon</b></A> : <textarea name="code" class="text" cols=50 rows=10>MYVAR=$(echo $LINE | sed 's/o\./O\./g' | sed 's/i\./I\./g')&#012; &#012;echo $MYVAR&#012;</textarea><!--end code block-->]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21461897</guid>
<pubDate>Fri, 21 Nov 2008 08:46:23 EDT</pubDate>
</item>

<item>
<title>Re: Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21460999</link>
<description><![CDATA[<A HREF="/useremail/u/715380"><b>Maxo</b></A> : I've never used sed before and have only recently began reading up on regular expressions.<br>I read through the man pages and looked at the code you gave.  It appears to work with the following code:<br><textarea name="code" class="text" cols=50 rows=10>echo $LINE | sed 's/o\./O\./g' | sed 's/i\./I\./g'&#012;</textarea><!--end code block--><br>The only thing that is missing is how to take the result of this output and store it in a variable.<br><br><small>--<br>"Padre, nobody said war was fun now bowl!" - Sherman T Potter<br><br>&raquo;<A HREF="http://www.cafepress.com/maxolasersquad" >www.cafepress.com/maxolasersquad</A><br><br>&raquo;<A HREF="http://maxolasersquad.com/" >maxolasersquad.com/</A><br><br>&raquo;<A HREF="http://maxolasersquad.com/network/" >maxolasersquad.com/network/</A> My DSL Network Guide<br><br>&raquo;<A HREF="http://myspace.com/mlsquad" >myspace.com/mlsquad</A></small>]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21460999</guid>
<pubDate>Thu, 20 Nov 2008 23:56:56 EDT</pubDate>
</item>

<item>
<title>Re: Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21460955</link>
<description><![CDATA[<A HREF="/useremail/u/715380"><b>Maxo</b></A> : the_char=`echo ${LINE:4:1} | tr a-z A-Z`<br>The above line just returns the given string literal, not the results of the echo.]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21460955</guid>
<pubDate>Thu, 20 Nov 2008 23:44:37 EDT</pubDate>
</item>

<item>
<title>Re: Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21459819</link>
<description><![CDATA[<A HREF="/useremail/u/0"><b>anon</b></A> : Agree, good call, at that point the regex would be positional on the file extension.]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21459819</guid>
<pubDate>Thu, 20 Nov 2008 19:59:50 EDT</pubDate>
</item>

<item>
<title>Re: Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21459727</link>
<description><![CDATA[<A HREF="/useremail/u/465839"><b>deblin</b></A> : <div class="bquote"><small>said by Sir Meowmix III :</small><br><br>What about using sed?<br><br>s/i/I/g s/o/O/g<br> </div>Good call, that'd work, if he anchor'd it to the ".", e.g.:<br><br><small>bash code</small>:<div class="syntax"><pre><span class="codetext"><font color="#FFFFFF">... <font color="#ffff00">|</font> <font color="#ffff00">sed</font> <font color="#ffff00">'</font><font color="#ff6060">s/o\./O./g</font><font color="#ffff00">'</font> <font color="#ffff00">|</font> <font color="#ffff00">sed</font> <font color="#ffff00">'</font><font color="#ff6060">s/i\./I\./g</font><font color="#ffff00">'</font><br></font></span></pre></div><br><small>--<br>He who is not contented with what he has, would not be contented with what he would like to have.  -Socrates</small>]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21459727</guid>
<pubDate>Thu, 20 Nov 2008 19:43:04 EDT</pubDate>
</item>

<item>
<title>Re: Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21459707</link>
<description><![CDATA[<A HREF="/useremail/u/0"><b>anon</b></A> : What about using sed?<br><br>s/i/I/g s/o/O/g]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21459707</guid>
<pubDate>Thu, 20 Nov 2008 19:38:51 EDT</pubDate>
</item>

<item>
<title>Re: Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21459007</link>
<description><![CDATA[<A HREF="/useremail/u/465839"><b>deblin</b></A> : Probably the easiest thing to do would be to set a variable for the letter first, then just use that variable.<br><br>e.g instead of:<br><br><small>bash code</small>:<div class="syntax"><pre><span class="codetext"><font color="#FFFFFF"><font color="#ffff00">echo</font><font color="#ff6060"> </font><font color="#ffff00">&quot;</font><font color="#ff6060"> column3 CONSTANT '</font><font color="#ffff00">&quot;</font><font color="#ff6060"> </font><font color="#ff40ff">${</font><font color="#ff40ff">LINE</font><font color="#ffff00">:</font><font color="#ff6060">4</font><font color="#ffff00">:</font><font color="#ff6060">1</font><font color="#ff40ff">}</font><font color="#ff6060"> </font><font color="#ffff00">|</font> tr <font color="#ffff00">'</font><font color="#ff6060">a-z</font><font color="#ffff00">'</font> <font color="#ffff00">'</font><font color="#ff6060">A-Z</font><font color="#ffff00">'</font> <font color="#ffff00">&quot;</font><font color="#ff6060">',</font><font color="#ffff00">&quot;</font> <font color="#ffff00">&gt;&gt;</font> file_loader.ctl<br></font></span></pre></div><br>try:<br><br><small>bash code</small>:<div class="syntax"><pre><span class="codetext"><font color="#FFFFFF"><font color="#00ffff">the_char</font>=<font color="#ff40ff">`echo </font><font color="#ff40ff">${</font><font color="#ff40ff">LINE</font><font color="#ffff00">:</font><font color="#ff6060">4</font><font color="#ffff00">:</font><font color="#ff6060">1</font><font color="#ff40ff">}</font><font color="#ff40ff"> </font><font color="#ffff00">|</font><font color="#ff40ff"> tr a-z A-Z`</font><br><font color="#ffff00">echo</font><font color="#ff6060"> </font><font color="#ffff00">&quot;</font><font color="#ff6060"> column3 CONSTANT '</font><font color="#ff40ff">$the_char</font><font color="#ff6060">',</font><font color="#ffff00">&quot;</font><font color="#ff6060"> </font><font color="#ffff00">&gt;&gt;</font> file_loader.tcl<br></font></span></pre></div><br>Again, assuming you just want the O there and not the full name. If you want the full name, it'd be slightly more involved but not terribly so.<br><br><small>--<br>He who is not contented with what he has, would not be contented with what he would like to have.  -Socrates</small>]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21459007</guid>
<pubDate>Thu, 20 Nov 2008 17:12:52 EDT</pubDate>
</item>

<item>
<title>Re: Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21458959</link>
<description><![CDATA[<A HREF="/useremail/u/465839"><b>deblin</b></A> : So in this line:<br><br> <blockquote><small>quote:</small><hr>echo " column3 CONSTANT '" ${LINE:4:1} | tr 'a-z' 'A-Z' "'," &gt;&gt; file_loader.ctl<br><hr></blockquote><br><br>You want just the capital letter?<br><br>E.g. for LINE = amico.990120 you want just the O?<br><br>Or do you want amicO.990120 ?<br><small>--<br>He who is not contented with what he has, would not be contented with what he would like to have.  -Socrates</small>]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21458959</guid>
<pubDate>Thu, 20 Nov 2008 17:00:40 EDT</pubDate>
</item>

<item>
<title>Re: Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21458945</link>
<description><![CDATA[<A HREF="/useremail/u/465839"><b>deblin</b></A> : <div class="bquote"><small>said by  Maxo <A HREF="/useremail/u/715380"><IMG SRC="http://i.dslr.net/bb/profile.gif" ALT="See Profile" BORDER=0 WIDTH=16 HEIGHT=11></A> :</small><br><br><div class="bquote"><small>said by  deblin <A HREF="/useremail/u/465839"><IMG SRC="http://i.dslr.net/bb/profile.gif" ALT="See Profile" BORDER=0 WIDTH=16 HEIGHT=11></A>  :</small><br><br>Looks like a good place for a perl script.  ;)</div>If you knew what Perl and I had been through the last two and a half weeks you wouldn't joke like that. :)<br> </div>heh! ok, well let me take a look.<br><small>--<br>He who is not contented with what he has, would not be contented with what he would like to have.  -Socrates</small>]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21458945</guid>
<pubDate>Thu, 20 Nov 2008 16:57:12 EDT</pubDate>
</item>

<item>
<title>Re: Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21458898</link>
<description><![CDATA[<A HREF="/useremail/u/715380"><b>Maxo</b></A> : <div class="bquote"><small>said by  deblin <A HREF="/useremail/u/465839"><IMG SRC="http://i.dslr.net/bb/profile.gif" ALT="See Profile" BORDER=0 WIDTH=16 HEIGHT=11></A> :</small><br><br>Looks like a good place for a perl script.  ;)</div>If you knew what Perl and I had been through the last two and a half weeks you wouldn't joke like that. :)]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21458898</guid>
<pubDate>Thu, 20 Nov 2008 16:47:46 EDT</pubDate>
</item>

<item>
<title>Re: Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21458872</link>
<description><![CDATA[<A HREF="/useremail/u/465839"><b>deblin</b></A> : Looks like a good place for a perl script.  ;)]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21458872</guid>
<pubDate>Thu, 20 Nov 2008 16:45:08 EDT</pubDate>
</item>

<item>
<title>Re: Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21458861</link>
<description><![CDATA[<A HREF="/useremail/u/715380"><b>Maxo</b></A> : I think I may need to be a little more specific.  We are writing a bash script that reads some stuff and builds a control file for Oracle's sqlldr, and then we execute sqlldr with the build control file.  Our code looks much like this:<br><textarea name="code" class="text" cols=50 rows=10>   if &#91; "${LINE}" = "amico.990120" &#93;;  then       &#012;      echo Building amic control file for ${LINE}&#012;      echo LOAD DATA               &gt; file_loader.ctl&#012;      echo INFILE \'${LINE}\'      &gt;&gt; file_loader.ctl&#012;      echo APPEND                  &gt;&gt; file_loader.ctl&#012;      echo INTO TABLE schema.table &gt;&gt; file_loader.ctl&#012;      echo "("                     &gt;&gt; file_loader.ctl&#012;      echo " column1(1:2),"        &gt;&gt; file_loader.ctl&#012;      echo " column2(3:4),"        &gt;&gt; file_loader.ctl&#012;      echo " column3 CONSTANT '" ${LINE:4:1} | tr 'a-z' 'A-Z' "'," &gt;&gt; file_loader.ctl&#012;      echo ")"                     &gt;&gt; file_loader.ctl&#012;      sqlldr user/pass@database file_loader.ctl log=sqlldr.log silent=FEEDBACK&#012;    else&#012;      echo No Amic file found&#012;    fi&#012;  done &lt; myAmicFiles&#012;</textarea><!--end code block--><br>The myAmicFiles just looks like this:<br>amici.990120<br>amici.990220<br>amico.990520<br>amico.990620<br><br>I need the i or o to be uppercase.<br><br><small>--<br>"Padre, nobody said war was fun now bowl!" - Sherman T Potter<br><br>&raquo;<A HREF="http://www.cafepress.com/maxolasersquad" >www.cafepress.com/maxolasersquad</A><br><br>&raquo;<A HREF="http://maxolasersquad.com/" >maxolasersquad.com/</A><br><br>&raquo;<A HREF="http://maxolasersquad.com/network/" >maxolasersquad.com/network/</A> My DSL Network Guide<br><br>&raquo;<A HREF="http://myspace.com/mlsquad" >myspace.com/mlsquad</A></small>]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21458861</guid>
<pubDate>Thu, 20 Nov 2008 16:42:54 EDT</pubDate>
</item>

<item>
<title>Re: Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21458809</link>
<description><![CDATA[<A HREF="/useremail/u/465839"><b>deblin</b></A> : oh ok! cool, should do the trick. :)]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21458809</guid>
<pubDate>Thu, 20 Nov 2008 16:31:57 EDT</pubDate>
</item>

<item>
<title>Re: Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21458799</link>
<description><![CDATA[<A HREF="/useremail/u/715380"><b>Maxo</b></A> : All the examples of tr that I saw had to take files.  I didn't think about using pipes.  I think that should work.  I'll try it and let you know.]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21458799</guid>
<pubDate>Thu, 20 Nov 2008 16:30:08 EDT</pubDate>
</item>

<item>
<title>Re: Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21458771</link>
<description><![CDATA[<A HREF="/useremail/u/465839"><b>deblin</b></A> : I suppose you can't use tr?<br><br>echo ${var:2:1} | tr 'a-z' 'A-Z'<br><br>would work, but I take it you want to avoid using tr?<br><small>--<br>He who is not contented with what he has, would not be contented with what he would like to have.  -Socrates</small>]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21458771</guid>
<pubDate>Thu, 20 Nov 2008 16:26:26 EDT</pubDate>
</item>

<item>
<title>Make variables uppercase in bash.</title>
<link>http://www.dslreports.com/forum/remark,21458754</link>
<description><![CDATA[<A HREF="/useremail/u/715380"><b>Maxo</b></A> : I am trying to take part of a string and make it uppercase.  For example:<br><tt>export var='abcdefg'<br>echo ${var:2:1}</tt><br>With the exception that I need this to return 'C', not 'c'.  The only thing I have been able to find are commands that take a whole file as a parameter and makes it all uppercase.  Can anyone help me do this please?]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,21458754</guid>
<pubDate>Thu, 20 Nov 2008 16:23:48 EDT</pubDate>
</item>

</channel>
</rss>
