LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Display the percentage of increase in data size for each month (https://www.linuxquestions.org/questions/linux-newbie-8/display-the-percentage-of-increase-in-data-size-for-each-month-4175481597/)

Bunty2013 10-21-2013 09:27 AM

Display the percentage of increase in data size for each month
 
I used to fetch monthly data from the database of table size and display in the below tabular form.

Table Name Jan-13 Feb-13 Mar-13---Nov-13 Dec-13
user_ 10MB 12MB 14 MB 15 MB 16.5 MB

This is use to handle at database level.

What help i want now is that, I wanted to display the percentage of increase in data size for each month by comparing the previous month.Here the example:

Table Name 13-Jan 13-Feb 13-Mar ----13-Nov 13-Dec YTD
user_ 10MB 12MB(20%) 14 MB(20%) 15 MB 16.5MB(10%) 65%


Here the Feb-13 is to being compared with Jan-13 and the percentage is to be taken out.The same for remember months as well.And at last I need the cumulative increase through out the year.

Is it possible at linux level, can we design the output as above? If yes, please help.

druuna 10-21-2013 10:26 AM

Quote:

Originally Posted by Bunty2013 (Post 5049657)
Table Name Jan-13 Feb-13 Mar-13---Nov-13 Dec-13
user_ 10MB 12MB 14 MB 15 MB 16.5 MB

Table Name 13-Jan 13-Feb 13-Mar ----13-Nov 13-Dec YTD
user_ 10MB 12MB(20%) 14 MB(20%) 15 MB 16.5MB(10%) 65%

Your input and output examples are inconsistent: Some entries have the amount and MB connected, some don't. If the input actually looks like that should the output copy that behaviour (last field in your example doesn't).

Please post relevant(!!) input and output examples and please put them between [code] ... [/code] tags to preserve multiple spaces/tabs and layout.

Also a question: Will the input switch to KB/GB when the size changes below 1 MB or above 1024 MB?

Bunty2013 10-21-2013 12:21 PM

Yah it will change to KB,MB,bytes,GB also


All times are GMT -5. The time now is 11:44 PM.