Annotation of researchv10no/ipc/mgrs/ns/mkdb/merge.sh, revision 1.1.1.1

1.1       root        1: echo merging $1 1>&2
                      2: sort -n | awk '
                      3: #
                      4: #      merge all lines with equivalent leading ids
                      5: #
                      6: BEGIN {
                      7:        line = ""; id = 0; last = ""
                      8: }
                      9: 
                     10: {
                     11:        #
                     12:        # skip duplicates
                     13:        #
                     14:        if($0==last)
                     15:                next;
                     16:        last = $0;
                     17:        if($1 != id){
                     18:                if(line!="")
                     19:                        print line;
                     20:                id = $1;
                     21:                line = $2;
                     22:        } else
                     23:                line = line " " $2;
                     24:        for(i=3; i<=NF; i++)
                     25:                line = line " " $i;
                     26: }
                     27: 
                     28: END {
                     29:        if(line!="")
                     30:                print line;
                     31: }
                     32: '

unix.superglobalmegacorp.com

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