HP3000-L Archives

May 1999, Week 3

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:
Jason Quigley <[log in to unmask]>
Reply To:
Date:
Fri, 21 May 1999 10:58:10 +0200
Content-Type:
multipart/alternative
Parts/Attachments:
BDY.RTF (1271 bytes) , BDY.RTF (2509 bytes)
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 -----



ATOM RSS1 RSS2