i dont want data in an array. i like to put my data file info (after filtering and converting to lower case) in to a string call "name". so it would look like this,
name= ffjtgj345 thgkty3 456gfhf rhtfn4 ......
how do i do that? i dont want to read # or blank lines.
i have following Kshell code. It is working almost perfect. Only issue is, when it writes in to the array, it start with location 1, instead of location 0. for example it will load the array as follows,
ignore[0]=
ignore[1]=wefwf12
ignore[2]=23dfjrtgt
.
.
ignore[n]=erfe3445
How do i get this issue fixed?
for i in $(grep -v "#" ../data/globallyIgnoredTc.dat | awk !/^$/ | awk -F" " '{print NR}' )
do
#echo i =$i
nam_arr[$i]=$(grep -v "#" ../data/globallyIgnoredTc.dat | awk !/^$/ | awk -F " " -v cnter=$i '{if (cnter == NR){print $1}}')
done
i=0
while [[ $i -lt ${#nam_arr[*]} ]] ; do
echo " nam_arr[$i] = ${nam_arr[$i]}"
let i=$i+1
done