I am trying to implementing two dimensinal array in ksh script.Would you pls help me out.
I have a large size of file, File contains looks like
ID SID VLAUE1 VALUE2 TOTALVALUE
1 a1 01 02 03
1 b1 02 05 07
3 c1 01 09 10
3 c1 11 09 20
.
.
.
I want to create a file or report which displays All the values by ID and SID
For example
Report By ID type
1 01 02 02 05 03 07
3 01 11 09 09 10 20
Report By SID type
a1 01 02 03
Then we can calculate minimum, maximum , avg values from the list.
---------- Post updated at 03:11 PM ---------- Previous update was at 02:57 PM ----------
#!/bin/ksh
Prev_Id=0;
i=0
file_name='$PWD/myfile'
tmp_file='$PWD/temp_file'
echo $file_name
echo $tmp_file
while read line; do
Id=$\(echo $line|awk '\{print $1\}'\)
Sid=$\(echo $line|awk '\{print $2\}'\)
Val1=$\(echo $line|awk '\{print $3\}'\)
Val2=$\(echo $line|awk '\{print $4\}'\)
Total_val=$\(echo $line|awk '\{print $5\}'\)
\#echo $Feed_Id
if [ $Prev_Id == $Id ];then
\#Here I want to push the Id and all the values into an array or hash that can hold uniq Id and all the values.
continue;
fi
done<$file_name
---------- Post updated at 03:54 PM ---------- Previous update was at 03:11 PM ----------
Can anyone help me out.