Blob
1 awk '2 BEGIN{3 print ".nr Rp 1" # supress ... Rx lines4 first=15 }7 #these come first8 $1=="..." && $2=="Rx"{9 ref[$4] = $310 next11 }13 first {14 printf(".lf %d %s\n", 1, inputfile)15 lineoffset=NR-116 first=017 }19 $1==".Rf"{20 if($2 in ref)21 $2=ref[$2]22 else23 printf("tref: %s:%d: no ref for %s\n",24 inputfile, NR-lineoffset, $2) >"/dev/stderr"25 }27 {28 print29 }31 ' $*