NAME
rank - Rank lines of text
VERSION
This document describes version 0.007 of rank (from Perl distribution App-rank), released on 2018-05-01.
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
(a.k.a. rank --numeric-sort
):
1 89 parjiyem
2 77 nono
3 75 robi
3 75 tedi
5 50 atang
6 30 budi
7 21 ujang
Sample output using rank -np
(a.k.a. rank --numeric-sort --show-percentile
):
1 100.000 89 parjiyem
2 85.714 77 nono
3 71.429 75 robi
3 71.429 75 tedi
5 42.857 50 atang
6 28.571 30 budi
7 14.286 21 ujang
Sample output using rank -n --calc-percentile 5,25,50,75,95
):
95.000 84.80000000
75.000 75.50000000
50.000 56.25000000
25.000 27.75000000
5.000 15.15000000
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
The default action is to show ranking (
rank
).Action
calc-percentile
will calculate specific percentiles. Usually you just specify--calc-percentile a,b,c,...
to set action tocalc-percentile
.--calc-percentile=f1,f2,...
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
Valid values:
numeric
,ascii
.--numeric-sort, -n
Shortcut for
--sort=numeric
. By default numeric sort order is descending instead of ascending. To do ascending sort, add-r
.--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 50 atang 6 30 budi 7 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 50 atang 5 30 budi 6 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 50 atang 6 30 budi 7 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.