[HPADM] awk script question

From: HAUTECOEUR Bruno (HAUTECOB@ESSILOR.fr)
Date: Tue Sep 17 2002 - 12:13:16 EDT


Hi admins,

i've a script question:

here is the script i would expect to work (but it doesn't):

for var in `cat file`
do
        awk 'BEGIN { i=0 }

        $1/^$var/ { printf("%s vaut %1.1f\n",$1,$2)
                      i=$2+i }

        END { printf("%s, %1.1f\n",$1,i) } ' volume

done

Well, if i put a string instead of $var, it works fine, but with $var, it
doesn't work .

any ideas ?

rgds,
________________
Bruno HAUTECOEUR
Architecte système Unix
DSI / Architecture Technique - Essilor International
Tel: 33 (0)1 48 98 73 20 / Fax: 33(0)1 49 56 20 56
mail: hautecob@essilor.fr

--
             ---> 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:19 EDT