From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,84a7f878cfa89481 X-Google-Attributes: gid1164f8,public From: "Adam Price" Subject: Re: Read multiple column figure. Date: 1999/03/24 Message-ID: <922306087.24689.0.nnrp-12.c2deb51d@news.demon.co.uk>#1/1 X-Deja-AN: 458602209 Content-Transfer-Encoding: 7bit X-NNTP-Posting-Host: pappnase.demon.co.uk:194.222.181.29 References: <7dahag$ncl$1@m5.att.net.hk> Content-Type: text/plain; charset="iso-8859-1" X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0 X-Complaints-To: abuse@demon.net X-Trace: news.demon.co.uk 922306087 nnrp-12:24689 NO-IDENT pappnase.demon.co.uk:194.222.181.29 Organization: none MIME-Version: 1.0 Newsgroups: comp.sys.dec Forest Gum wrote in message <7dahag$ncl$1@m5.att.net.hk>... >Dear All, > >Does any one have the ready procedure to capture the source data that in >column format into field. > >For example : > >Month A sales B sales C sales >Feb 100 K 200 K 200 K >Mar 100 K 300 K > >I want to capture field A_total = X + Y where X = 100K and Y = 100K. > >Thanks ! > > What OS, What language, what format of input, This might work on unix (No machine at home to try it on) If you want VMS or RSX11 then somebody else will have to help. Or you could buy a spread-sheet program. #!/bin/sh DATA_FILE=$1 grep -v '^Month' $DATA_FILE | \ awk 'BEGIN {total=0} $3=="K" {total =total +(1000 * $2) ; $2=0} {total=total+$2} END{print total / 1000 , "K"}'