From: Lal, Neeraj (Neeraj.Lal@Pfizer.com)
Date: Thu Jan 09 2003 - 17:59:07 EST
Hi Admins
Thanks for the quick response from Alan Riggs her is the solution
awk '{print $1}' t |uniq | while read NAME
>do
>awk -v NAME=$NAME 'IF $1 == NAME , TOT+=$2 {} END {print NAME"\t"TOT}' t
>done
but when started using big no the value started comming in exponetial form
so I changed a little bit
echo " TOAL SALES FOR EACH BUYING GROUP" > lal
awk '{print $1}' $outfile |uniq | while read NAME
do
awk -v NAME=$NAME 'IF $1 == NAME , TOT+=$2 {} END {printf NAME"\t" "%.2f\n",
TOT}' $outfile >> lal
done
and i got my wanted results
Pls dont send no more response my problem is solved
Thanks
-----Original Message-----
From: Lal, Neeraj [mailto:Neeraj.Lal@Pfizer.com]
Sent: Thursday, January 09, 2003 4:14 PM
To: 'hpux-admin@DutchWorks.nl'
Subject: [HPADM] Script question to add the values in column
Hi Admins
A small script question
I have a file with
Cutomer No Sales
Lal 122.00
Lal 222.00
Manish 3343.00
Manish 33333.34
Rajesh 383.00
Rajesh 38383.00
this file is sorted on Customer NO.. Now thru script I want to create a
report like this
Addition of all sales
Lal 344.00
Manish 63676.00
Rajesh 38766.00
How it can be done thru script
Thanks
Neeraj Lal,
p Consultant
Consumer Healthcare IS
Neeraj.Lal@Pfizer.com
Fax : 973-385-7290
-- ---> Please post QUESTIONS and SUMMARIES only!! <--- To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl Name: hpux-admin@dutchworks.nl Owner: owner-hpux-admin@dutchworks.nl Archives: ftp.dutchworks.nl:/pub/digests/hpux-admin (FTP, browse only) http://www.dutchworks.nl/htbin/hpsysadmin (Web, browse & search) -- ---> Please post QUESTIONS and SUMMARIES only!! <--- To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl Name: hpux-admin@dutchworks.nl Owner: owner-hpux-admin@dutchworks.nl Archives: ftp.dutchworks.nl:/pub/digests/hpux-admin (FTP, browse only) http://www.dutchworks.nl/htbin/hpsysadmin (Web, browse & search)
This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:24 EDT