hello i was trying to read a line to array using ksh script . But some of its values are stored multiple times in adjacent array elements when there is a comma in the field value. How can this is avoided my delimiter is ~
input
17~4~~~char~Y~\"[_a-zA-Z0-9\.]\+@[a-zA-Z0-9]\+\.[a-z]\{2,\}\"~40~email id
code
while IFS= read -r line
do
if [ $n != 1 ]; then
IFS="~"
set -A star $line
col_pos=${star[1]}
col_patt=${star[6]}
col_len=${star[7]}
col_file_id=${star[0]}
value of $line
17 4 char Y \"[_a-zA-Z0-9\.]\+@[a-zA-Z0-9]\+\.[a-z]\2\" \"[_a-zA-Z0-9\.]\+@[a-zA-Z0-9]\+\.[a-z]\\\" 40 email id
The issue is that pattern ("[_a-zA-Z0-9.]+@[a-zA-Z0-9]+.[a-z]\2") is duplicated while reading, but in actual input file the pattern field is defined once.