|
|
1.1 root 1: echo "add unique id" 1>&2
2: cat $* | awk '
3: #
4: # unique is an array that associates a numeric id with each
5: # symbolic one
6: #
7: BEGIN {
8: nextid=1;
9: }
10: #
11: # add com/att to the front of a dk string to make a unique id
12: #
13: $1=="uucp" {
14: line = $2 " " $2 ".att.com"; # uucp host name
15: for (i=3; i<=NF; i++)
16: if(match($i, "/")){
17: n = split($i,a,"/");
18: uid = a[n];
19: for(j=n-1; j>=1; j--)
20: uid = uid "." a[j];
21: line = line " DK," $i " DOMAIN," uid ".att.com"
22: } else
23: line = line " " $i
24: print line
25: next;
26: }
27: #
28: # invert order of domain components to make a unique id
29: #
30: $1=="hosts" {
31: line = $2; # inet number
32: for (i=3; i<=NF; i++)
33: if(match($i, ".att.com")){
34: line = line " DOMAIN," $i
35: } else
36: line = line " " $i
37: print line
38: next;
39: }
40: ' | rmdups.sh
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.