The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
know the size of database megh HP-UX 1 07-19-2008 08:06 AM
Recursively find and change Permissions on Man pages altamaha Security 5 03-25-2008 06:00 AM
command to find out total size of a specific file size (spread over the server) abhinov SUN Solaris 3 08-08-2007 06:48 AM
command(s) to find size of mysql database? sbourgeois UNIX for Dummies Questions & Answers 4 06-12-2006 12:40 AM
database image size ppass SUN Solaris 6 05-31-2005 08:48 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-10-2009
family_guy family_guy is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 11
find the size of a database by counting all the used pages

Hi all,

I am looking to find the size of the database by counting all the used pages.

1. 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
  #2 (permalink)  
Old 03-10-2009
R.T. R.T. is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 12
Are you familiar with awk?
You could try
Code:
awk '{print $1" x "$2" = "$1*$2}' filename
$1 would be the first field, $2 would be the second, etc.
  #3 (permalink)  
Old 03-10-2009
family_guy family_guy is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 11
can you guide me in reading those values into variables...like putting 16384 into A and 32XXX into B etc
  #4 (permalink)  
Old 03-10-2009
R.T. R.T. is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 12
Code:
awk '{A=$1;B=$2;print A" x "B" = "A*B}' filename

Last edited by R.T.; 03-10-2009 at 03:54 PM.. Reason: Needed code tags
  #5 (permalink)  
Old 03-10-2009
family_guy family_guy is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 11
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)
  #6 (permalink)  
Old 03-10-2009
R.T. R.T. is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 12
Code:
awk '{A=$1;B=$2;C=C+A*B;print A" x "B" = "A*B};END{print "Total = "C}' filename

Last edited by R.T.; 03-10-2009 at 07:32 PM.. Reason: dropped a }
  #7 (permalink)  
Old 03-10-2009
family_guy family_guy is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 11
you rock

you rock bud...thnx a ton
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 04:22 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0