Subject: | |
From: | |
Reply To: | |
Date: | Thu, 7 Aug 2003 13:21:47 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Hello,
try this :
$x="word1:word2"
$w1=${x#*:}
$w2=${x%:*}
$echo $w1 $w2
word2 word1
Michael
On Thu, 7 Aug 2003 09:22:08 -0700, John Burke <[log in to unmask]>
wrote:
>I'm very much a newbie to shell scripting. I'm trying to convert a CI
>command script to a shell script. I've successfully gotten all the
>boilerplate stuff converted but have a few simple questions (simple for
>shell script mavens). My first question concerns converting the following
CI
>commands:
>
> setvar _field_name word(_input_string, ":", 1)
> setvar _field_value word(_input_string, ":", 2)
>
>Basically I'm parsing a character string into two pieces where ":" is the
>delimiter (always present) and the second part could be null (the first
part
>never is null). How do I do this in a shell script?
>
>John
>
>* To join/leave the list, search archives, change list settings, *
>* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|