|
|
1.1 ! root 1: sed -e 's/<tab>/:/' -e 's/^ //' $1.idx|sort|uniq|awk ' ! 2: BEGIN {FS=":"} ! 3: { if($1 != laststr){ ! 4: if(start){ ! 5: if(range)pages = pages "-" npage ! 6: if(global != "")print laststr "," pages " " global ! 7: else print laststr "," pages ! 8: } ! 9: start=1 ! 10: laststr=$1 ! 11: global=$3 ! 12: pages = " " $2 ! 13: npage = 0 + $2 ! 14: range=0 ! 15: } ! 16: else { ! 17: if($2 == npage+1){ ! 18: range=1 ! 19: npage++ ! 20: next ! 21: } ! 22: else if(range) pages = pages "-" npage "," $2 ! 23: else pages = pages "," $2 ! 24: npage = 0 + $2 ! 25: range = 0 ! 26: } ! 27: } ! 28: END { ! 29: if(range)pages = pages "-" npage ! 30: if(global != "")print laststr "," pages " " global ! 31: else print laststr "," pages ! 32: } ! 33: ' >$1.index
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.