Path: utzoo!utgpu!water!watmath!clyde!rutgers!mcnc!rti!tijc02!seb022 From: seb022@tijc02.UUCP (Scott Bemis ) Newsgroups: comp.unix.questions Subject: AWK QUESTION (AT&T UNIX V REL. 2.0 VERSION 2) Message-ID: <186@tijc02.UUCP> Date: 18 Dec 87 21:34:17 GMT Organization: Texas Instr., Johnson City TN Lines: 144 12/18/87 The the awk program below works ok on an ms-dos version of awk I have on my pc from Mortice Kern Systems Inc. (MKS awk). The book called "The AWK Programming Language" by the authors of awk: Aho, Weinberger, and Kernighan. refers to user created awk functions and the ** operator to support exponentiation. The ms-dos version of awk from Mortice Kern Systems Inc. supports reference user created awk functions and the ** operator to support exponentiation. Unfortuately, neither feature appears to be supported in the version of awk that I have on my vax 8600. This VAX 8600 is using a port of AT&T UNIX V Release 2.0 Version 2 operating system. Does anyone sell, or provide an awk for AT&T UNIX V Release 2.0 Version for VAXes that supports the ** operator for exponentiation and user created functions. Since I do not know how to get the version number of my awk on the VAX 8600, here is a listing from the /usr/src/cmd/awk directory: total 157 -rw-rw---- 1 bin bin 2662 Jul 4 1983 EXPLAIN -rw-rw---- 1 bin bin 2974 Jul 4 1983 README -rw-rw---- 1 bin bin 3169 Jul 4 1983 awk.def -rw-rw---- 1 bin bin 6385 Jul 4 1983 awk.g.y -rw-rw---- 1 bin bin 4936 Jul 4 1983 awk.lx.l -rw-rw---- 1 bin bin 2226 Nov 7 1983 awk.mk -rw-rw---- 1 bin bin 10877 Jul 4 1983 b.c -rw-rw---- 1 bin bin 528 Jul 4 1983 freeze.c -rw-rw---- 1 bin bin 6537 Jul 4 1983 lib.c -rw-rw---- 1 bin bin 2167 Jul 4 1983 main.c -rw-rw---- 1 bin bin 2379 Jul 4 1983 makeprctab.c -rw-rw---- 1 bin bin 2386 Jul 4 1983 parse.c -rw-rw---- 1 bin bin 2377 Jul 4 1983 proc.c -rw-rw---- 1 bin bin 15629 Jul 4 1983 run.c -rw-rw---- 1 bin bin 1520 Jul 3 1984 token.c -rw-rw---- 1 bin bin 118 Jul 4 1983 tokenscript -rw-rw---- 1 bin bin 6301 Jul 4 1983 tran.c Below is the awk program that works with awk from Mortice Kern Systems Inc. (MKS awk) with ms-dos. It DOES NOT work with the awk on the VAX 8600. BEGIN { # new record separator RS = "sec" # build look-up arrays # tt_types 0..15 (0x00..0x0f) split("L V K X Y CR X-PAC Y-PAC CR-PAC WX WY ** ** ** TCP TCC",tt1) # tt_types 16..23 (0x10..0x17) split("DSP DSC DCP ** ** ** ** **",tt2) # tt_types 45..53 (0x2d..0x3f) split("LSTATUS ** ** ** ** ** ** ** Lmode",tt3) # tt_type 69 (0x45) split("AVF",tt4) # tt_types 96..108 (0x60..0x6c) split("LKC LTI LTD LHA LLA LPV LPVH LPVL LODA LYDA LTS LSP LMN",tt5) # tt_types 112..119 (0x70..0x77) split("LERR LMX LHHA LLLA LRCA ** RSS RDS",tt6) # tt_types 120..127 (0x78..0x7f) split("RRC ST SD RSESB AHA ALA APV APVH",tt7) # tt_types 128..138 (0x80..0x8a) split("APVL AODA AYDA ATS ASP ** ** AERR AHHA ALLA ARC",tt8) # tt_types 240,241 (0xf0, 0xf1) split("V. K.",tt9) } # conv decimal tt_type to element name string function tt_name(n) { if (n <= 15) { return tt1[n+1] } else if(n <= 23) { return tt2[n-15] } else if(n <= 53) { return tt3[n-44] } else if(n <= 69) { return tt4[n-68] } else if(n <= 108) { return tt5[n-95] } else if(n <= 119) { return tt6[n-111] } else if(n <= 127) { return tt7[n-119] } else if(n <= 138) { return tt8[n-127] } else if(n <= 241) { return tt9[n-239] } else { return "UNKNOWN" } } # convert hex string to decimal function frhex(str) { tot = 0 l = length(str) { for(i=0; i