Help for this page

Select Code to Download


  1. or download this
    LC_ALL=C sort -k1 big{1,2,3}.txt | awk -f tally-count.awk | LC_ALL=C s
    +ort -k2nr >out.txt
    
    ...
    LC_ALL=C parsort -k1 big{1,2,3}.txt | ./tally-count | LC_ALL=C parsort
    + -k2nr >out.txt
    
    real time:  3.615 seconds
    
  2. or download this
    LC_ALL=C parsort -k1 big{1,2,3}.txt | awk -f tally-count.awk | LC_ALL=
    +C parsort -k2nr >out.txt
    
    ...
    LC_ALL=C parsort -k1 big{1,2,3}.txt | ./tally-count | LC_ALL=C parsort
    + -k2nr >out.txt
    
    real time:  2.398 seconds
    
  3. or download this
    cat big{1,2,3}.txt | ./linux-q -tT "select c1, sum(c2) from - group by
    + c1 order by sum(c2) desc, c1" >out.txt
    
    ...
    ./linux-q -tT "select c1, sum(c2) from big[1-3].txt group by c1 order 
    +by sum(c2) desc, c1" >out.txt
    
    real time: 89.539 seconds
    
  4. or download this
    # Tally adjacent count fields of duplicate key names.
    
    ...
    END {
       print key, sum
    }
    
  5. or download this
    // -------------------------------------------------------------------
    +---------
    // tally-count.cpp
    ...
    
       return 0;
    }