HP3000-L Archives

August 2003, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Michael Abootorab <[log in to unmask]>
Reply To:
Michael Abootorab <[log in to unmask]>
Date:
Thu, 7 Aug 2003 13:21:47 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (39 lines)
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 *

ATOM RSS1 RSS2