Answer the question
In order to leave comments, you need to log in
I fill the array element by element and lose the data that I filled in the "while read line", how to fix it?
/////SOLVED I
fill in some elements of the array
while read line
do
ggg=1
for jfARRAY in 3 5 4
do
mline1=`echo $line | grep "statsu" | cut -d ';' -f $jfARRAY`
MDERIVE1_1[$ggg]=`echo $mline1 | sed 's/[\.]\{0,1\}[0]*$//'`
let ggg=$ggg+1
done
done <$forcornumb_1
MDERIVE1_1[0]=`echo "$toderive2_1" | grep "statsu" | cut -d ';' -f 1`
eota=4
for MYvalues in 2 10 11 12
do
MDERIVE1_1[$eota]=`echo "$toderive2_1" | grep "statsu" | cut -d ';' -f $MYvalues`
let eota=$eota+1
done
Answer the question
In order to leave comments, you need to log in
There is a grep filter in the code. And when a string came across without the desired substring, everything was overwritten with emptiness. Decided with a different filter. (Removed grep, put "case line in / esac"). Thus, the "left" substring does not reach the entry at all and does not overwrite the array with emptiness.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question