Hi,
I'm trying to use a variable to initialize a new variable in a for loop. Is this possible? If not any other way in ksh to do this?
for x in main1 main2
do
${x}string1=$(grep string1 file1 | wc -l)
${x}string2=$(grep string2 file1 | wc -l)
done
The variables I was hoping to define are as follows:
$main1string1
$main1string2
$main2string1
$main2string2
Thanks, Denis
I'm trying to use a variable to initialize a new variable in a for loop. Is this possible? If not any other way in ksh to do this?
for x in main1 main2
do
${x}string1=$(grep string1 file1 | wc -l)
${x}string2=$(grep string2 file1 | wc -l)
done
The variables I was hoping to define are as follows:
$main1string1
$main1string2
$main2string1
$main2string2
Thanks, Denis