# PATHTO.AWK 1.3 # # Created by: Michel Lebel and Gabriela Simonka 98-10-02 # # (c) INRO Consultant Inc. Montreal, 1998 # # Syntax: # # gawk -f pathto.awk filename # # # Using the transcript file (filename) generated in Module 6.15, this script # yields the path attribute for the shortest paths TO A SPECIFIED NODE, based # on the selected measure (distance, time or cost) and attributes the value # to the FIRST link of the shortest path. # # This information is written to a file (TOLINK.LST), which will be used # to input the values to a link user defined or extra attribute in Module 2.41. # # Another output file (TONODE.LST) lists the destination ROOT node and the nodes # that are inaccessible, along with a marking value to be used as a node color # index in Module 2.13. # # N.B.: The output files TONODE.LST and TOLINK.LST are overwritten each # time this script is run. Therefore rename these files if you desire to # keep this information, (or input the values directly into node/link # attributes). # # # BEGIN {node="tonode.lst"; link="tolink.lst"; fileopen[node]=1; fileopen[link]=1;} # # Write header in output files TONODE.LST and TOLINK.LST # $1~/c/ {if ($2=="Shortest") {printf("Link path attribute for paths to root destination based on %s\n",$6)>link; printf(" inode jnode %8s mvalue\n",$6)>>link; printf("Root destination and inaccessible node listing for paths based on %s\n",$6)>node; printf(" inode mvalue\n")>>node;} else next;} # # Obtain INODE ($5), JNODE ($6) and path attribute value ($4) # # If there are only 4 arguments in record, then TO-NODE is inaccessible. # Write inaccessible node ($2) to file with marking value. # # If there are only 5 arguments in record, then TO and FROM NODES are # same. Write root origin node($3) to file with marking value. # $1~/a/ {if (NF>5) printf("%6d %6d %8s 1\n",$5,$6,$4)>>link; else if (NF==4) {inaccnd=$2; printf("%6d 6\n",inaccnd)>>node;} else if (NF==5) {orignd=$5; printf("%6d 4\n",orignd)>>node;} } # # If first argument of line in FILENAME is neither "a" nor "c", skip record # $1!~/a/&&$1!~/c/ {next;} # END {close (node); close (link);}