awk weirdness on DU

From: Pat Wilson <paw_at_northstar.dartmouth.edu>
Date: Thu, 19 Mar 1998 18:14:21 +0000

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_at_dartmouth.edu
Received on Fri Mar 20 1998 - 00:14:33 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:37 NZDT