|
|
1.1 root 1: sed 's/,/ /' x|
2: awk '
3: BEGIN {FS=" "
4: while((getline<"contents") > 0){
5: names[$0] = 1
6: }
7: }
8: {if($1 == term){
9: ck = substr($2,2,index($2,",")-2)
10: if(ck in names){
11: sub(/^ /, " \\fI", $2)
12: sub(/,/,"\\fP,", $2)
13: }
14: printit(" " $2)
15: }
16: else {
17: term = $1
18: if(term in names){
19: sub(" ","\\fP,")
20: sub(/^/,"\\fI")
21: }
22: else {
23: sub(",","\\fP,")
24: sub(" ",",\\fI")
25: }
26: printit($0)
27: }}
28: function printit(line){
29: if(length(line)<40)print line
30: else {
31: n=split(line, a, ",")
32: if(length(a[1])>=40){
33: m=split(a[1],b," ")
34: nline=b[1]
35: for(i=2;i<=m;i++){
36: nline = nline " " b[i]
37: if(length(nline)>=40){
38: print nline
39: nline = " "
40: }
41: }
42: for(i=2; i<=n;i++){
43: if(nline == " ")nline = nline a[i]
44: else nline = nline "," a[i]
45: }
46: print nline
47: return
48: }
49: nline=a[1]
50: for(i=2;i<=n;i++){
51: nline = nline "," a[i]
52: if(length(nline)>= 40){
53: if(i < n)print nline ","
54: else print nline
55: if(i < n)nline = " " a[++i]
56: else nline = ""
57: }
58: }
59: if(length(nline) > 0)print nline
60: }
61: }'
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.