Hi all,
I am looking to find the size of the database by counting all the used pages.
- I have a file which reads like below
16384 4750850
32768 165
The first column is the pagesize and the second column is the number of pages associated.
So what i am trying is to do is read the file and put the values in 4 variables A,B,C,D....if A = 16384 then E = $A * $B(4750850)
So how do i read 16384 into A and so on....
thanks in advance
R.T
2
Are you familiar with awk?
You could try
awk '{print $1" x "$2" = "$1*$2}' filename
$1 would be the first field, $2 would be the second, etc.
can you guide me in reading those values into variables...like putting 16384 into A and 32XXX into B etc
R.T
4
awk '{A=$1;B=$2;print A" x "B" = "A*B}' filename
How can i get the grand total?
awk '{A=$1;B=$2;print A" x "B" = "A*B}' out
16384 x 4750850 = 7.78379e+10
32768 x 165 = 5406720
Looking for a total ( 7.7XXXX + 5406720)
R.T
6
awk '{A=$1;B=$2;C=C+A*B;print A" x "B" = "A*B};END{print "Total = "C}' filename
you rock bud...thnx a ton