[ale] Thanks - and another Bash script question

Geoffrey esoteric at 3times25.net
Thu May 15 15:02:21 EDT 2003


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

Seems you might be pretty much screwed here.  I thought you could set 
the IFS to ',' to resolve this issue, but apparently the ct=() syntax in 
bash does not use the IFS for field separation.  I would say that's a 
bug personally, but that's my opinion.  I can separate a string that is 
delimited by ',' using awk, but can't see a way to plug it into a 
variable of the form of ct[1] ct[2]...  Here's the awk script that will 
translate your , delimited fields into separately quoted strings:

echo foo,bar,foo bar |
awk -F',' '{for (i=1;i<=NF;i++) {printf "\"%s\" ", $i};print "\n"}'

-- 
Until later: Geoffrey		esoteric at 3times25.net

The latest, most widespread virus?  Microsoft end user agreement.
Think about it...

_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale





More information about the Ale mailing list