Dear forum users,
i'm trying to read a table with 40x122 data in a array. Following this, i'd plot each rows again the header of the file in gnuplot.
i was thinking for something like that
#!/bin/bash
# reads from the $ips file and assigns to $MYARRAY
#IFS =";" split the line after the ;
#set -- $array save the each row of the line in $1 $2 $3 $4 ....
myfile="Comprasion.txt"
ln=`wc -l $myfile|awk '{print $1}'`
i=1
#echo "$ln"
declare -a sgs
for ((i==1; i<=$ln; i++)); do
line=`awk "NR==$i" $myfile`
#echo "$line"
declare -a row
linarray=(`echo ${line// / }`);
#echo "${#linarray
[*]}" # OK.
#echo "${#linarray
[*]}" # OK.
row=(`echo ${#linarray
[*]}`);
echo "*********"
#echo "$row"
r=1
for ((r==1;r<=$row;r++)); do
#echo "variable $i $r"; # OK.
sgs[${i},${r}]=(`echo ${linearray[$r]}`);
var=${sgs[${i},${r}]};
echo "$var";
done
#echo "$i";
done
if i run the script, unfortunately, i get nothing. Where do i have problem?
thanks in advance for your help
---------- Post updated at 07:26 PM ---------- Previous update was at 03:43 PM ----------
nobody has a suggestion