Blob


1 awk '
2 BEGIN{
3 print ".nr Rp 1" # supress ... Rx lines
4 first=1
5 }
7 #these come first
8 $1=="..." && $2=="Rx"{
9 ref[$4] = $3
10 next
11 }
13 first {
14 printf(".lf %d %s\n", 1, inputfile)
15 lineoffset=NR-1
16 first=0
17 }
19 $1==".Rf"{
20 if($2 in ref)
21 $2=ref[$2]
22 else
23 printf("tref: %s:%d: no ref for %s\n",
24 inputfile, NR-lineoffset, $2) >"/dev/stderr"
25 }
27 {
28 print
29 }
31 ' $*