[ale] Thanks - and another Bash script question

Bob Kruger bkruger at mindspring.com
Thu May 15 12:02:17 EDT 2003


Problem with that is some of the comma delimited fields that I would like to capture into the array have spaces in them.

Bob


-------Original Message-------
From: "Michael D. Hirsch" <mhirsch at nubridges.com>
To: ale at ale.org
Sent: 05/15/03 11:35 AM
To: ale at ale.org
Subject: Re: [ale] Thanks - and another Bash script question

> 
> On Thursday 15 May 2003 11:27 am, Bob Kruger wrote:
> My thanks to all who assisted.  I should have been more specific - I did
> have access to some of the basic Unix commands.  The solutions provided
> were adequate.
>
> I have one more question concerning arrays.  I know that if I do the
> following:
>
> cn=(This is a test)
>
> then $cn[1] = "This" , $cn[2] = "is", etc...
> And to see them I would "echo {$cn[1]}"
>
> If I have a line with comma based delimiters, how would I read that into
> an array, e.g.
>
> ct={This,is,a,test)
>
> and have $ct[1] = "This" , $ct[2] = "is" , etc?

man tr

Or just read the previous solutions that used tr.  They should tell you
all 
you need to convert the commas to spaces, thus reducing the problem to the 

first case.

Michael
_______________________________________________
Ale mailing list
Ale at ale.org
<a target=_blank
href="http://www.ale.org/mailman/listinfo/ale">http://www.ale.org/mailman/listinfo/ale</a>
> 
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale





More information about the Ale mailing list