4359 links
  • Arnaud's links
  • Home
  • Login
  • RSS Feed
  • ATOM Feed
  • Tag cloud
  • Picture wall
  • Daily
Links per page: 20 50 100
  • thumbnail
    bash - median of column with awk - Stack Overflow
    This awk program assumes one column of numerically sorted data:

    #/usr/bin/env awk
    {
        count[NR] = $1;
    }
    END {
        if (NR % 2) {
            print count[(NR + 1) / 2];
        } else {
            print (count[(NR / 2)] + count[(NR / 2) + 1]) / 2.0;
        }
    }

    Sample usage:

    sort -n data_file | awk -f median.awk
    August 2, 2016 at 5:33:42 PM GMT+2 * - permalink - archive.org - http://stackoverflow.com/questions/6166375/median-of-column-with-awk
    median awk
Links per page: 20 50 100
Shaarli - The personal, minimalist, super fast, database-free, bookmarking service by the Shaarli community - Help/documentation