NAME

rank - Rank lines of text

VERSION

This document describes version 0.004 of rank (from Perl distribution App-rank), released on 2018-04-25.

SYNOPSIS

rank [OPTION]... [FILE]...

DESCRIPTION

rank ranks lines of text, by default using the first field as the sort key (can be changed with --sort-field option). When there are multiple lines that have the same sort key, rank will assign the same rank to the lines. Finally, the lines will be displayed with the ranks, starting from the highest ranked (1).

Sample input:

21    ujang
30    budi
50    atang
75    robi
89    parjiyem
77    nono
75    tedi

Sample output using rank -n:

1    89    parjiyem
2    77    nono
3    75    robi
3    75    tedi
5    30    budi
6    21    ujang

Sample output using rank -np:

1    100.000   89    parjiyem
2    85.714    77    nono
3    71.429    75    robi
3    71.429    75    tedi
5    42.857    30    budi
6    14.286    21    ujang

EXIT CODES

0 on success.

255 on I/O error.

99 on command-line options error.

OPTIONS

  • --action=s (default: rank)

    Valid values: rank, calc-percentile

  • --calc-percentile=f, ...

    Imply --action=calc-percentile. Calculate specific percentile(s). Will use linear interpolation to get the percentile values.

  • --reverse, -r

  • --ignore-leading-blanks, -b

  • --ignore-case, -i

  • --field-separator, -f (default: Tab)

  • --sort=s

  • --numeric-sort, -n

  • --sort-field=i (default: 0)

  • rank=s (default: default)

    Change ranking system. The default is to have all lines that have the same sort keys to be ranked the same, but the next ranking will skip numbers:

    1    89    parjiyem
    2    77    nono
    3    75    robi
    3    75    tedi
    5    30    budi
    6    21    ujang

    The no-skip ranking system will not do these skips:

    1    89    parjiyem
    2    77    nono
    3    75    robi
    3    75    tedi
    4    30    budi
    5    21    ujang

    The no-same ranking system will assign different ranks to lines that have the same sort key:

    1    89    parjiyem
    2    77    nono
    3    75    robi
    4    75    tedi
    5    30    budi
    6    21    ujang
  • --no-show-rank

  • --show-percentile, -p

  • --help, -h

  • --version, -v

FAQ

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/App-rank.

SOURCE

Source repository is at https://github.com/perlancar/perl-App-rank.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-rank

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

sort

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.