Pádraig Brady wrote, On 02/07/2012 11:00 AM: > On 02/07/2012 03:56 PM, Peng Yu wrote: >> >> Suppose that I have a table of the following, where the last column is >> a number. I'd like to accumulate the number of rows that are the same >> for all the remaining columns. >> > > Thanks for the suggestion, > but this is too specialized for coreutils I think.
Slightly off-topic for coreutils, but a package called "BEDTools" ( http://code.google.com/p/bedtools/ ) provides a program called "groupBy", which does exactly that, and more. Akin to SQL's "group by" command, the program can group a text file by a specified column, and perform operations (count,sum,mean,median,etc.) on another column. -gordon
