ksh scripting: separate ',' values have transient commas?
i try ksh book guess record consisting name-value pairs, several any line.
format is:
name1 value1,name2 value2,name3 value3, etc
suppose i write:
read l
ifs=","
set -a nvls $l
echo "$nvls[2]"
this give me second name-value pair, good easy. now, suspect assign extended values consolidate commas. should escaped, this:
name1 value1,name2 value2_1\,value2_2,name3 value3, etc
obviously, formula longer works, given "read" strips quoting second component array only "name2 value2_1".
i'm stranded comparison ksh does have "read -a array". i attempted several tricks "read -r" "eval set -a ....", avail. i can't "read nvl1 nvl2 nvl3" unescaping bursting inside read, given i dont know formerly name-value pairs any line.
does anyone have useful pretence adult sleeve me?
ps
i know i have scratch perl, python, even awk. however, i have ksh (... die perplexing ;)
Comments
Post a Comment