App-PTP
view release on metacpan or search on metacpan
modified.
=item B<-n> I<code>
Execute the given perl code for each line of the input. Replace each line with
the return value from the code. The input line is in the B<$_> variable. If the
return value is B<undef> then the line is removed.
See the note on new-line characters given in the description of the B<--perl>
command.
An error in the Perl code will result in a message printed to the standard
output but the processing will continue. The current line will not be modified.
=item B<-f> I<code>, B<--filter>
Execute the given perl code for each line of the input and keep the lines where
the return value from the code is true. The input line is in the the B<$_>
variable. Note that you can modify that variable, but you probably should avoid
doing it.
An error in the Perl code will result in a message printed to the standard
output but the processing will continue. The current line will not be removed.
=item B<-e> I<code>, B<--execute>
Execute the given code. As other command, this will be executed once per input
file being processed. This command can be used to initialize variables or
functions used in B<--perl> or B<-n> commands.
Any error in the Perl code will terminate the execution of the program.
=item B<-l> I<path>, B<--load>
Same as B<--execute> except that it takes the code to execute from the given
file.
Any error in the Perl code will terminate the execution of the program.
=item B<-M> I<module>
Load the given Perl module in the Perl environment. This option cannot be used
when B<--safe> is specified with level strictly greater than 0.
=item B<--sort>
Sort the content of the input using the default lexicographic order. Or the
comparator specified with the B<--comparator> flag.
Any error in the Perl code of the comparator will terminate the execution of the
program.
=item B<--ns>, B<--numeric-sort>
Sort the content of the input using a numeric sort. The numeric value of each
line is extracted by parsing a number at the beginning of the line (which should
look like a number).
The markers of the input lines are reset (no line is marked after this command).
=item B<--ls>, B<--locale-sort>
Sort the content of the input using a locale sensitive sorting. The exact
meaning of this depends on the configuration of your system (see the
L<perllocale> documentation for more details). In practice, it will do things
like correctly comparing equivalent characters and/or ignoring the case.
The markers of the input lines are reset (no line is marked after this command).
=item B<--ss>, B<--semver-sort>
Sort the content of the input as version strings, following the precedence
rules of L<Semantic Versioning|https://semver.org>. So, for example, C<1.9.0>
sorts before C<1.10.0> (instead of after it as a lexicographic sort would do)
and a pre-release version such as C<1.0.0-alpha> sorts before the corresponding
release C<1.0.0>. An optional leading C<v> and an optional prefix terminated by
C</> are also recognized.
The markers of the input lines are reset (no line is marked after this command).
=item B<--cs> I<code>, B<--custom-sort>
Sort the content of the input using the given custom comparator. See the
B<--comparator> flag for a specification of the argument of this command.
All markers are unset after this operation.
=item B<-u>, B<--unique>
Remove consecutive lines that are identical. You will often want to have a
B<--sort> step before this one.
The markers of the lines that are kept are not changed.
=item B<--gu>, B<--global-unique>
Remove duplicate lines in the file, even if they are not consecutive. The first
occurrence of each line is kept.
The markers of the lines that are kept are not changed.
=item B<--head> [I<n>]
Keep only the first I<n> lines of the input. If the number of line is
negative then remove that much lines from the end of the input. if I<n> is
omitted, then uses some default value.
=item B<--tail> [I<n>]
Keep only the last I<n> lines of the input. If the number of line is
negative then remove that much lines from the beginning of the input. if I<n> is
omitted, then uses some default value.
=item B<--reverse>, B<--tac>
Reverse the order of the lines of the input. The markers of each lines are
preserved (they are reversed with the input).
=item B<--shuffle>
Shuffle all the lines of the input in random order. The markers of the input
lines are reset (no line is marked after this command).
=item B<--eat>
( run in 0.604 second using v1.01-cache-2.11-cpan-5735350b133 )