All Downloads are FREE. Search and download functionalities are using the official Maven repository.

command-definition.sort.xml Maven / Gradle / Ivy

There is a newer version: 0.6
Show newest version
<?xml version="1.0"?>
<command-def	xmlns="http://www.unix4j.org/command-def" 
				xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
				xsi:schemaLocation="http://www.unix4j.org/command-def command-def.xsd">
	
	<command name="sort" class="org.unix4j.unix.Sort" package="org.unix4j.unix.sort"/>
	<name>
		sort - sort, merge, or sequence check text files
	</name>
	<synopsis>
		ORIGINAL:	sort [-m][-o output][-bdfinru][-t char][-k keydef]... [file...]
					sort -c [-bdfinru][-t char][-k keydef][file]
		CURRENT:	sort [-MVbdfghnru | comparator][file...]
					sortMerge [-MVbdfghnru | comparator][file...]
					sortCheck [-MVbdfghnru | comparator][file...]
	</synopsis>
	<description ref="sort.html"/>
	<notes>
		<note>
		A &lt;newline&gt; is added to the end of an input line if it is not
		properly terminated with a line ending (usually the last line in a file)
		</note>
		<!-- TODO implement sort options and remove the following notes -->
		<note>The following sort order options are currently not supported: {@code dictionaryOrder}, {@code humanNumericSort}, {@code monthSort}, {@code versionSort}</note>
	</notes>
	<methods>
		<method args="" usesStandardInput="true">
			Sort the lines read from the standard input and writes the result to
			the standard output. 
			
			Comparisons are based on the entire line without line ending. The 
			collating sequence of the current locale is used to perform the
			comparisons. 
			
			The sort algorithm used is guaranteed to be stable: lines considered
			equal will not be reordered as a result of the sort.
		</method>
		<method args="args" usesStandardInput="false">
			Sort the lines of all the specified files together and writes the
			result to the standard output.
			
			Options can be specified by acronym (with a leading dash "-") or by 
			long name (with two leading dashes "--"). Operands other than the 
			default "--paths" operand have to be prefixed with the operand 
			name. 
			
			The sort algorithm used is guaranteed to be stable: lines considered
			equal will not be reordered as a result of the sort. If two lines 
			originate from different input files, the index of the file in the
			input arguments list defines the ordering of the lines. 
		</method>
		<method args="files" usesStandardInput="false">
			Sort the lines of all the specified files together and writes the
			result to the standard output. 
			
			Comparisons are based on the entire line without line ending. The 
			collating sequence of the current locale is used to perform the
			comparisons. 
			
			The sort algorithm used is guaranteed to be stable: lines considered
			equal will not be reordered as a result of the sort. If two lines 
			originate from different input files, the index of the file in the
			input arguments list defines the ordering of the lines. 
		</method>
		<method args="comparator" usesStandardInput="true">
			Sort the lines read from the standard input and writes the result to
			the standard output. 
			
			Line comparisons are based on the specified {@code comparator}.
			
			The sort algorithm used is guaranteed to be stable: lines considered
			equal will not be reordered as a result of the sort.
		</method>
		<method args="comparator,files" usesStandardInput="false">
			Sort the lines of all the specified files together and writes the
			result to the standard output. 
			
			Line comparisons are based on the specified {@code comparator}.
			
			The sort algorithm used is guaranteed to be stable: lines considered
			equal will not be reordered as a result of the sort. If two lines 
			originate from different input files, the index of the file in the
			input arguments list defines the ordering of the lines. 
		</method>
		<method args="comparator,paths" usesStandardInput="false">
			Sort the lines of all the specified files together and writes the
			result to the standard output. 
			
			Line comparisons are based on the specified {@code comparator}.
			
			The sort algorithm used is guaranteed to be stable: lines considered
			equal will not be reordered as a result of the sort. If two lines 
			originate from different input files, the index of the file in the
			input arguments list defines the ordering of the lines. 
		</method>
		<method args="options" usesStandardInput="true">
			Sorts, merges, or sequence checks the lines read from the standard
			input and writes the result to the standard output. 
			
			Comparisons are based on the entire line without line ending. The 
			collating sequence of the current locale is used to perform the
			comparisons. 
			
			The sort algorithm used is guaranteed to be stable: lines considered
			equal will not be reordered as a result of the sort.
		</method>
		<method args="options,files" usesStandardInput="false">
			Sorts, merges, or sequence checks the lines the lines of all the
			specified files together and writes the result to the standard
			output. 
			
			Comparisons are based on the entire line without line ending. The 
			collating sequence of the current locale is used to perform the
			comparisons. 
			
			The sort algorithm used is guaranteed to be stable: lines considered
			equal will not be reordered as a result of the sort. If two lines 
			originate from different input files, the index of the file in the
			input arguments list defines the ordering of the lines. 
		</method>
		<method args="options,paths" usesStandardInput="false">
			Sorts, merges, or sequence checks the lines the lines of all the
			specified files together and writes the result to the standard
			output. 
			
			Comparisons are based on the entire line without line ending. The 
			collating sequence of the current locale is used to perform the
			comparisons. 
			
			The sort algorithm used is guaranteed to be stable: lines considered
			equal will not be reordered as a result of the sort. If two lines 
			originate from different input files, the index of the file in the
			input arguments list defines the ordering of the lines. 
		</method>
		<method args="options,comparator" usesStandardInput="true">
			Sorts, merges, or sequence checks the lines read from the standard
			input and writes the result to the standard output. 
			
			Line comparisons are based on the specified {@code comparator}. 
			All comparison related options are ignored except for
			{@code --reverse}.
			
			The sort algorithm used is guaranteed to be stable: lines considered
			equal will not be reordered as a result of the sort.
		</method>
		<method args="options,comparator,files" usesStandardInput="false">
			Sorts, merges, or sequence checks the lines the lines of all the
			specified files together and writes the result to the standard
			output. 
			
			Line comparisons are based on the specified {@code comparator}. 
			All comparison related options except for {@code --reverse} are 
			ignored.
			
			The sort algorithm used is guaranteed to be stable: lines considered
			equal will not be reordered as a result of the sort. If two lines 
			originate from different input files, the index of the file in the
			input arguments list defines the ordering of the lines. 
		</method>
		<method args="options,comparator,paths" usesStandardInput="false">
			Sorts, merges, or sequence checks the lines the lines of all the
			specified files together and writes the result to the standard
			output. 
			
			Line comparisons are based on the specified {@code comparator}. 
			All comparison related options except for {@code --reverse} are 
			ignored.
			
			The sort algorithm used is guaranteed to be stable: lines considered
			equal will not be reordered as a result of the sort. If two lines 
			originate from different input files, the index of the file in the
			input arguments list defines the ordering of the lines. 
		</method>
	</methods>
	<options>
		sort [-m][-o output][-bdfinru][-t char][-k keydef]... [file...]
		sort -c [-bdfinru][-t char][-k keydef][file]
		<option name="check" acronym="c" exclusiveGroup="mc">
			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.
		</option>
		<option name="merge" acronym="m" exclusiveGroup="mc">
			Merge only; the input file are assumed to be already sorted.
		</option>
		<option name="unique" acronym="u">
			Unique: suppress all but one in each set of lines having equal keys.
			If used with the {@code -c} option, checks that there are no lines 
			with duplicate keys, in addition to checking that the input file is 
			sorted.
		</option>
		<option name="ignoreLeadingBlanks" acronym="b">
			Ignore leading blanks. 
			(This option is ignored if a comparator operand is present).
		</option>
		<option name="dictionaryOrder" acronym="d">
			Consider only blanks and alphanumeric characters.
			(This option is ignored if a comparator operand is present).
		</option>
		<option name="ignoreCase" acronym="f">
			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).
		</option>
		<option name="numericSort" acronym="n" exclusiveGroup="nghVM">
			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
			{@code -genericNumericSort (-g)} option. 

			(This option is ignored if a comparator operand is present).
		</option>
		<option name="generalNumericSort" acronym="g" exclusiveGroup="nghVM">
			Sort numerically, using the standard {@link 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 &lt; +0); "Infinity"; "NaN".

			This option is usually slower than {@code -numeric-sort (-n)} and it
			can lose information when converting to floating point.		
		
			(This option is ignored if a comparator operand is present).
		</option>
		<option name="humanNumericSort" acronym='h' exclusiveGroup="nghVM">
			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 {@code ls} command that are invoked with the --human-readable 
			option. 
			
			The syntax for numbers is the same as for the
			{@code --numericSort (-n)} option; the SI suffix must immediately 
			follow the number. 		

			(This option is ignored if a comparator operand is present).
		</option>
		<option name="monthSort" acronym="M" exclusiveGroup="nghVM">
			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) &lt; 'JAN' &lt; ... &lt; 'DEC'. The current locale
			determines the month spellings. 
		</option>
		<option name="versionSort" acronym="V" exclusiveGroup="nghVM">
			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).
		</option>
		<option name="reverse" acronym="r">
			Reverse the sense of comparisons.
		</option>
	</options>
	<operands default="paths">
		<operand name="paths" type="String...">
			Pathnames of the files to be sorted, merged, or checked; wildcards * 
			and ? are supported; relative paths are resolved on the
            basis of the current working directory.
		</operand>
		<operand name="files" type="java.io.File...">
			The files to be sorted or merged; relative paths are not resolved 
			(use the string paths argument to enable relative path resolving 
			based on the current working directory).
		</operand>
		<operand name="comparator" type="java.util.Comparator&lt;? super org.unix4j.line.Line>">
			The comparator to use for the line comparisons.
		</operand>
		<!-- 
		<operand name="keydef" type="Keydef">
			The files to be sorted or merged.
		</operand>
		 -->
		<!--
		<operand name="separatorChars" type="String">
			Use {@code separatorChars} as the field separator; 
			{@code separatorChars} is not considered to be part of a field 
			(although it can be included in a sort key). Each occurrence of
			{@code separatorChars} is significant (for example, two consecutive 
			{@code separatorChars} delimit an empty field). If not specified, 
			whilespace characters (tabs, spaces) are used as default field 
			separators; each maximal non-empty sequence of whitespace chars that
			follows a non-whitespace char is a field separator.
		</operand>
		<operand name="fieldStart" type="int">
			Define a key field that begins at {@code fieldStart} and ends at
			{@code fieldEnd} inclusive, unless {@code fieldStart} falls beyond 
			the end of the line or after {@code fieldEnd}, in which case the key
			field is empty.
			
			A field comprises a maximal sequence of non-separating characters 
			and, in the absence of a {@code separatorChar}, any preceding field
			separator.
		</operand>
		<operand name="fieldEnd" type="int">
			Define a key field that begins at {@code fieldStart} and ends at
			{@code fieldEnd} inclusive, unless {@code fieldStart} falls beyond 
			the end of the line or after {@code fieldEnd}, in which case the key
			field is empty. A missing {@code fieldEnd} means the last character
			of the line.		

			A field comprises a maximal sequence of non-separating characters 
			and, in the absence of a {@code separatorChar}, any preceding field
			separator.
		</operand>
		<operand name="fieldType" type="FieldType">
			A modifier similar to the options 'b', 'd', 'f', 'i', 'n', 'r' 
			defined for sort, but applies only to the key field to which they
			are attached. 
		</operand>
		<operand name="keydef" type="Keydef">
			The keydef argument is a restricted sort key field definition. When
			there are multiple key fields, later keys are compared only after
			all earlier keys compare equal. Except when the -u option is 
			specified, lines that otherwise compare equal are ordered as if none
			of the options -d, -f, -i, -n, or -k were present (but with -r still 
			in effect, if it was specified) and with all bytes in the lines 
			significant to the comparison. The order in which lines that still 
			compare equal are written is unspecified.		
		</operand>
		-->
		<operand name="args" type="String...">
			String arguments defining the options and operands for the command. 
			Options can be specified by acronym (with a leading dash "-") or by 
			long name (with two leading dashes "--"). Operands other than the
			default "--paths" operand have to be prefixed with the operand 
			name (e.g. "--comparator" for a subsequent comparator operand value). 
		</operand>
		<operand name="options" type="SortOptions">
			The options for the sort command.
		</operand>
	</operands>
</command-def>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy