Hi Mark!
If you know that you only have these three parts separated by a
space, you can use cut or awk as follows:
avar="part1 part2 part3"
var1=`echo $avar | cut -f1 -d" "`
var2=`echo $avar | cut -f2 -d" "`
var3=`echo $avar | cut -f3 -d" "`
or
avar="part1 part2 part3"
var1=`echo $avar | awk '{print $1}'`
var2=`echo $avar | awk '{print $2}'`
var3=`echo $avar | awk '{print $3}'`
HTH
Jason.
> ----- Original Message -----
> From: [log in to unmask]
[SMTP:[log in to unmask]]
> Sent: Thursday, May 20, 1999, 19:10:14
> To: [log in to unmask]
> Cc: [log in to unmask]
> Subject: Regular Expression blues!
>
> Am trying to write a simple shell-script to take a variable which has
three
> "parts" and break it down into three seperate variables. Maybe I'm
using
> regexps
> wrongly here - or maybe there is a simpler way - but I just *can't*
get
> "expr"
> to work!!
>
> Shell/iX > avar="part1 part2 part3"
> Shell/iX > expr $avar : '([^[:space:]]+)'
> Usage : expr expression
> Shell/iX >
>
> Can anyone tell me the correct regexps to use to extract part1, part2
and
> part3.
> I'm stumped.
>
> Thanks.
>
> Mark W.
> SPE.
>
> <<File:Regular Expression blues!.TXT>>
> ----- End Of Original Message -----