Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!decvax!wivax!linus!allegra!eagle!mhuxt!mhuxi!mhuxa!houxm!ihnp4!ixn5c!inuxc!pur-ee!uiucdcs!parsec!kolstad From: kolstad@parsec.UUCP Newsgroups: net.sources Subject: awk scripts for connection matrix - (nf) Message-ID: <2174@uiucdcs.UUCP> Date: Thu, 2-Jun-83 23:42:08 EDT Article-I.D.: uiucdcs.2174 Posted: Thu Jun 2 23:42:08 1983 Date-Received: Thu, 9-Jun-83 02:31:25 EDT Lines: 34 #N:parsec:42500010:000:1147 parsec!kolstad Jun 1 13:41:00 1983 Here are two awk scripts to help you manipulate the connection list (in another note). One of the scripts ("doubler") creates the other triangle of the connection matrix; the other creates a human readable connection map. doubler: -------------------------------------------------------- # this file takes a set of records of form "a b" and # outputs two records for each one: "a b" and "b a" # BEGIN { FS = " " } $1 != $2 {print $1 " " $2; print $2 " " $1} -------------------------------------------------------- awk -f doubler < connects > bigconnects makemap: -------------------------------------------------------- # given a long set of sorted pairs of connectivities: # a b / a c / d e / d f # this gives: ab c # d e f \ # g h [continued line] # NR == 1 {src = $1; line = $1 " "; n = 0} $1 == src {if(n>8){print line " \\"; line = " " $2; n = 1} else {line = line " " $2; n++}} $1 != src {print line; src = $1; line = $1 " " $2; n = 0} END {print line} ------------------------------------------------------------- sort -u bigconnects > bigconnects2 awk -f makemap bigconnects2 > newmap