[ale] If there a neat way of peeling apart bash variable by delimters?
Neal Rhodes
neal at mnopltd.com
Sun Sep 14 19:41:20 EDT 2014
If in a shell script, you have a variable loaded with a character value,
and there is a delimiter, and you want to peel it apart by that
delimiter, is there a built-in expression to do that?
Here's what I'm doing, and I'm thinking there should be a better way.
FULLNAME=$1 #eg:
CustomerEntry.CreditLimit
DOT=`expr index $FULLNAME .`
DOTM1=`expr $DOT - 1`
TABLE=${FULLNAME:0:$DOTM1}
FIELD=${FULLNAME:$DOT:40}
Neal Rhodes
President, MNOP Ltd
Lilburn, GA
770-972-5430
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20140914/3c89902c/attachment.html>
More information about the Ale
mailing list