Hi,
I have 2 variables which is having like the below data
a=x.1 y.2 z.3 m.4
b=No (zero) rows read (0)~ No (zero) rows read (0)~ Complete: 273894 row(s)~ Complete: 729002 row(s)~
I need a file which should contain
x.1,No (zero) rows read (0)~
y.2,No (zero) rows read (0)~
z.3,Complete: 273894 row(s)~
m.4,Complete: 729002 row(s)~
RudiC
2
Try this. I'm sure you can cope yourself with the leading blanks in BR[]...
AR=($a)
IFS="~" BR=($b)
for ((i=0; i<${#AR[@]}; i++)); do printf "%s,%s~\n" ${AR[$i]} ${BR[$i]}; done
x.1,No (zero) rows read (0) ~
y.2, No (zero) rows read (0) ~
z.3, Complete: 273894 row(s) ~
m.4, Complete: 729002 row(s) ~
set -- $a
i=1;
while [ $i -le $# ]
do
eval echo -n \$$i
echo $b | awk -F"~" -v var=$i '{ print ","$var}'
i=`expr $i + 1`
done