From: "Adam Price" <adam+usenet@pappnase.demon.co.uk>
Subject: Re: Read multiple column figure.
Date: 1999/03/24 [thread overview]
Message-ID: <922306087.24689.0.nnrp-12.c2deb51d@news.demon.co.uk> (raw)
In-Reply-To: 7dahag$ncl$1@m5.att.net.hk
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"}'
next prev parent reply other threads:[~1999-03-24 5:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-24 5:00 Read multiple column figure Forest Gum
1999-03-24 5:00 ` Adam Price [this message]
1999-03-25 5:00 ` Forest Gum
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox