Annotation of researchv10dc/vol2/index/tools/combind.awk, revision 1.1.1.1

1.1       root        1: 
                      2: BEGIN  {FS=":"}
                      3:        { if($1 != laststr){
                      4:                if(start){
                      5:                        if(range)pages = pages "-" npage
                      6:                        print laststr "," pages
                      7:                }
                      8:                start=1
                      9:                laststr=$1
                     10:                pages = " " $2
                     11:                npage = 0 + $2
                     12:                range=0
                     13:        }
                     14:        else {
                     15:                if($2 == npage+1){
                     16:                        range=1
                     17:                        npage++
                     18:                        next
                     19:                }
                     20:                else if(range) pages = pages "-" npage "," $2
                     21:                else pages = pages "," $2
                     22:                npage = 0 + $2
                     23:                range = 0
                     24:        }
                     25: }
                     26: END    {
                     27:        if(range)pages = pages "-" npage
                     28:        print laststr "," pages
                     29:        }
                     30: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.