<div dir="ltr"><p dir="ltr">A bash equivalent of perl @array=split (delim, $string);  would be ideal.</p><p dir="ltr"><br></p><p>string=&#39;my,long,string,of,crap&#39;</p><p>OFS=$IFS</p><p>IFS=&#39;,&#39; read -a array &lt;&lt;&lt; &quot;$string<code>&quot;</code></p><p>now extract bits as needed:</p><p>echo &quot;${array[0]}&quot;</p><p>my</p><p>echo &quot;${array[1]}&quot;</p><p>long</p><p>etc.<br></p><p><br></p><p><code></code></p><p><code><br></code></p><p><code><br></code></p><pre style class=""><code><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class=""></span></code>On Sep 15, 2014 9:28 PM, &quot;Neal Rhodes&quot; &lt;<a href="mailto:neal@mnopltd.com" target="_blank">neal@mnopltd.com</a>&gt; wrote:<br type="attribution"></pre><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Thanks.  That is a smidge more compact.  Although it doesn&#39;t quite jump<br>
off the page w.r.t. readability.<br>
<br>
I was hoping for something along the lines of Progress:<br>
        Table = entry(1, FullName, &quot;.&quot;).<br>
<br>
But I shall take a look at BASH_REMATCH.<br>
<br>
On Sun, 2014-09-14 at 21:38 -0400, Michael H. Warfield wrote:<br>
<br>
&gt; On Sun, 2014-09-14 at 19:41 -0400, Neal Rhodes wrote:<br>
&gt; &gt; If in a shell script, you have a variable loaded with a character value,<br>
&gt; &gt; and there is a delimiter, and you want to peel it apart by that<br>
&gt; &gt; delimiter, is there a built-in expression to do that?<br>
&gt;<br>
&gt; &gt; Here&#39;s what I&#39;m doing, and I&#39;m thinking there should be a better way.<br>
&gt;<br>
&gt; &gt;         FULLNAME=$1                                  #eg:<br>
&gt; &gt; CustomerEntry.CreditLimit<br>
&gt; &gt;         DOT=`expr index $FULLNAME .`<br>
&gt; &gt;         DOTM1=`expr $DOT - 1`<br>
&gt; &gt;         TABLE=${FULLNAME:0:$DOTM1}<br>
&gt; &gt;         FIELD=${FULLNAME:$DOT:40}<br>
&gt;<br>
&gt; Yes there is.  You specifically said &quot;bash&quot; in the subject and in the<br>
&gt; talks we&#39;ve had a ALE and AUUG over &quot;belts and suspenders bash&quot; the<br>
&gt; speaker mentioned using regex&#39;s in bash and accessing the underlying<br>
&gt; substring results.  Look for BASH_REMATCH variables and the =~ operator<br>
&gt; in the bash documentation.<br>
&gt;<br>
&gt; --<br>
&gt; FOO=CustomerEntry.CreditLimit<br>
&gt;<br>
&gt; if [[ &quot;${FOO}&quot; =~ (.*)\.(.*) ]] ; then<br>
&gt;       echo &quot;${BASH_REMATCH[1]} : ${BASH_REMATCH[2]}&quot;<br>
&gt; else<br>
&gt;       echo nope<br>
&gt; fi<br>
&gt;<br>
&gt; CustomerEntry : CreditLimit<br>
&gt; --<br>
&gt;<br>
&gt; Is that what you&#39;re after?<br>
&gt;<br>
&gt; &gt; Neal Rhodes<br>
&gt; &gt; President, MNOP Ltd<br>
&gt; &gt; Lilburn, GA<br>
&gt; &gt; <a href="tel:770-972-5430" value="+17709725430" target="_blank">770-972-5430</a><br>
&gt; &gt; -------------- next part --------------<br>
&gt; &gt; An HTML attachment was scrubbed...<br>
&gt; &gt; URL: &lt;<a href="http://mail.ale.org/pipermail/ale/attachments/20140914/3c89902c/attachment.html" target="_blank">http://mail.ale.org/pipermail/ale/attachments/20140914/3c89902c/attachment.html</a>&gt;<br>
&gt;<br>
&gt; Regards,<br>
&gt; Mike<br>
<br>
<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: &lt;<a href="http://mail.ale.org/pipermail/ale/attachments/20140915/8848b893/attachment.html" target="_blank">http://mail.ale.org/pipermail/ale/attachments/20140915/8848b893/attachment.html</a>&gt;<br>
_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
</blockquote></div>
</div>