Dear Users,
i have following input data. See attachment. Now i want to modify my data with this small script but something goes wrong. See line 107 of output data when you run the small script.
There should be written:
2 1 6
but instead there is
2 2 6
is there any way to fix it? I hope you understand what i am trying to do.
Thanks a lot.
i have following input data. See attachment. Now i want to modify my data with this small script but something goes wrong. See line 107 of output data when you run the small script.
There should be written:
2 1 6
but instead there is
2 2 6
is there any way to fix it? I hope you understand what i am trying to do.
Code:
input=test.b
awk '{print $2,$4,$5,$7}' ${input} > clean.txt
rm out.txt
touch out.txt
typeset -i y
typeset -i counter=0
while read x1 y1 y2 h
do
counter=counter+1
if [ $counter -eq 1 ]; then
for i in `seq $y1 $y2`
do
y=$i
echo "${x1} ${y} ${h}" >> out.txt
done
elif [ $counter -gt 1 ]; then
for i in `seq $(expr $y1 + 1) $y2`
do
y=$i
echo "${x1} ${y} ${h}" >> out.txt
done
fi
done < clean.txt
Thanks a lot.