Sponsored Content
Full Discussion: How to get sub_total
Top Forums Shell Programming and Scripting How to get sub_total Post 302472144 by ken002 on Tuesday 16th of November 2010 11:28:22 AM
Old 11-16-2010
How to get sub_total

Hi, Unix Gurus
I have a requriement as following;
source file
Code:
ID, MONTHS,                  TOTAL_AMT
1   01,02,03                     9000
2   01,02,03,04                 8000
3   03,04,05,06,07,08,09    14000

The months column may cantains 12 months

expected target
Code:
ID BUDGET_MON  BUDGET_AMT
1      01             3000
1      02             3000
1      03             3000
2      01             2000
2      02             2000
2      03             2000
2      04             2000
3      03             2000
3      04             2000
3      05             2000
3      06             2000
3      07             2000
3      08             2000
3      09             2000

Basically, I need print out every single month and monthly budget which is total_amt divided by number of months in second column.

Thanks in advance

Last edited by Franklin52; 11-16-2010 at 01:20 PM.. Reason: Please use code tags
ken002
 
PAPS(1) 						      General Commands Manual							   PAPS(1)

NAME
paps - UTF-8 to PostScript converter using Pango SYNOPSIS
paps [options] files... DESCRIPTION
paps reads a UTF-8 encoded file and generates a PostScript language rendering of the file. The rendering is done by creating outline curves through the pango ft2 backend. OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. --landscape Landscape output. Default is portrait. --columns=cl Number of columns output. Default is 1. Please notice this option isn't related to the terminal length as in a "80 culums terminal". --font=desc Set the font description. Default is Monospace 12. --rtl Do right to left (RTL) layout. --paper ps Choose paper size. Known paper sizes are legal, letter and A4. Default is A4. Postscript points Each postscript point equals to 1/72 of an inch. 36 points are 1/2 of an inch. --bottom-margin=bm Set bottom margin. Default is 36 postscript points. --top-margin=tm Set top margin. Default is 36 postscript points. --left-margin=lm Set left margin. Default is 36 postscript points. --right-margin=rm Set right margin. Default is 36 postscript points. --gutter-width=gw Set gutter width. Default is 40 postscript points. --help Show summary of options. --header Draw page header for each page. --markup Interpret the text as pango markup. --lpi Set the lines per inch. This determines the line spacing. --cpi Set the characters per inch. This is an alternative method of specifying the font size. --stretch-chars Indicates that characters should be stretched in the y-direction to fill up their vertical space. This is similar to the texttops behaviour. AUTHOR
paps was written by Dov Grobgeld <dov.grobgeld@gmail.com>. This manual page was written by Lior Kaplan <kaplan@debian.org>, for the Debian project (but may be used by others). April 17, 2006 PAPS(1)
All times are GMT -4. The time now is 09:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy