tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: Pat Wilson <paw () northstar ! dartmouth ! edu>
To: tru64-unix-managers
Subject: awk weirdness on DU
Date: Thu, 19 Mar 1998 18:14:21 +0000	[thread overview]
Message-ID: <96078701111568.tru64-unix-managers.marc@archive.invalid> (raw)


I've trying to run a program containing a rather complex awk script (I
didn't write it, so I can't really explain how it's doing what it does).  
Said script works on AIX, HPUX, and IRIX, but not on DU (3.2G _or_ 4.0+).  
Are there any known differences between Digital's awk and everyone else's?  
Is POSIX biting me again?

The awk piece is:

     awk 'BEGIN { FS="#" ; RS=">" }
           { i=0 ; printf "%s", $1
             for (j=3; j<NF; j+=2)
               { for (k=i; k>0; k--)
                   { if ($j > a[k]) break
                     a[k+1]=a[k] ; n[k+1]=n[k] }
                 i++ ; k++ ; a[k]=$j ; n[k]=$(j+1) }
             for (j=1; j<=i; j++) printf " %s %s", a[j], n[j]
             printf "\n" }' 

The file it's processesing is of the form

	>northstar.dartmouth.edu    #Dartmouth College, Project Northstar
	129.170.16.43                   #cygnusx1.dartmouth.edu
	129.170.16.205                  #beehive.dartmouth.edu
	129.170.24.37                   #andromeda.dartmouth.edu
	129.170.24.115                  #horsehead.dartmouth.edu

Expected output is

	northstar.dartmouth.edu 129.170.16.205 beehive.dartmouth.edu 129.170.16.43 cygnusx1.dartmouth.edu 129.170.24.115 horsehead.dartmouth.edu 129.170.24.37 andromeda.dartmouth.edu

but DU gives me


	northstar.dartmouth.edu andromeda.dartmouth.edu
	129.170.24.115 horsehead.dartmouth.edu
	 cygnusx1.dartmouth.edu
	129.170.16.205 beehive.dartmouth.edu
	129.170.24.37

Any ideas?

Thanks.

Pat Wilson
paw@dartmouth.edu

                 reply	other threads:[~1998-03-19 18:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
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