public interface SortOptions extends OptionSet<SortOption>
sort
command.
It is recommended to use Sort.Options
to specify a valid
combination of options.
The options for the sort command are:
-c | --check | Checks that the single input file is ordered as specified by the arguments and the collating sequence of the current locale. No output is produced; only the exit code is affected. | |||
-m | --merge | Merge only; the input file are assumed to be already sorted. | |||
-u | --unique | Unique: suppress all but one in each set of lines having equal keys.
If used with the -c option, checks that there are no lines
with duplicate keys, in addition to checking that the input file is
sorted. | |||
-b | --ignoreLeadingBlanks | Ignore leading blanks. (This option is ignored if a comparator operand is present). | |||
-d | --dictionaryOrder | Consider only blanks and alphanumeric characters. (This option is ignored if a comparator operand is present). | |||
-f | --ignoreCase | Consider all lowercase characters that have uppercase equivalents to be the uppercase equivalent for the purposes of comparison. (This option is ignored if a comparator operand is present). | |||
-n | --numericSort | Sort numerically; the number begins each line and consists of
optional blanks, an optional minus sign, and zero or more digits
possibly separated by thousands separators, optionally followed by a
decimal-point character and zero or more digits. An empty number is
treated as '0'. The current local specifies the decimal-point
character and thousands separator.
Comparison is exact; there is no rounding error.
Neither a leading '+' nor exponential notation is recognized. To
compare such strings numerically, use the
(This option is ignored if a comparator operand is present). | |||
-g | --generalNumericSort | Sort numerically, using the standard Double.parseDouble(String)
function to convert a trimmed line to a double-precision floating
point number. This allows floating point numbers to be specified in
scientific notation, like 1.0e-34 and 10e100.
Uses the following collating sequence: Lines that cannot be parsed because they do not represent valid double values (in alpha-numeric order); "-Infinity"; finite numbers in ascending numeric order (with -0 < +0); "Infinity"; "NaN".
This option is usually slower than (This option is ignored if a comparator operand is present). | |||
-h | --humanNumericSort | Sort numerically, first by numeric sign (negative, zero, or
positive); then by SI suffix (either empty, or 'k' or 'K', or one
of 'MGTPEZY', in that order); and finally by numeric value. For
example, '1023M' sorts before '1G' because 'M' (mega) precedes 'G'
(giga) as an SI suffix.
This option sorts values that are consistently scaled to the nearest
suffix, regardless of whether suffixes denote powers of 1000 or
1024, and it therefore sorts the output of any single invocation of
the
The syntax for numbers is the same as for the
(This option is ignored if a comparator operand is present). | |||
-M | --monthSort | An initial string, consisting of any amount of blanks, followed by a month name abbreviation, is folded to UPPER case and compared in the order: (unknown) < 'JAN' < ... < 'DEC'. The current locale determines the month spellings. | |||
-V | --versionSort | Sort by version name and number. It behaves like a standard sort,
except that each sequence of decimal digits is treated numerically
as an index/version number.
(This option is ignored if a comparator operand is present). | |||
-r | --reverse | Reverse the sense of comparisons. |
This interface serves as an alias for the extended interface to simplify the command signature methods by avoiding generic parameters.
Modifier and Type | Interface and Description |
---|---|
static class |
SortOptions.Default
Default implementation for a modifiable option set.
|
Modifier and Type | Field and Description |
---|---|
static ValueConverter<SortOptions> |
CONVERTER
Value converter for
SortOptions based on an OptionSetConverters.OptionSetConverter . |
static SortOptions |
EMPTY
Constant for an empty option set.
|
asSet, isSet, iterator, optionType, size, useAcronymFor
forEach, spliterator
static final SortOptions EMPTY
static final ValueConverter<SortOptions> CONVERTER
SortOptions
based on an OptionSetConverters.OptionSetConverter
.Copyright © 2024. All rights reserved.