public final class Uniq extends Object
NAME
uniq - report or filter out repeated lines in a usually pre-sorted file
SYNOPSIS
uniq | |
uniq <args> | |
uniq <file> | |
uniq <path> | |
uniq [-cdug] | |
uniq [-cdug] <file> | |
uniq [-cdug] <path> |
See Uniq.Interface
for the corresponding command signature methods.
DESCRIPTION
Reads from the standard input or from a specified input file and compares adjacent lines, writing one copy of each input line on the output. The second and succeeding copies of repeated adjacent input lines are not written to the output.
Note that repeated non-adjacent lines in the input are only detected with the --global or -g option. In other words, unique output lines are guaranteed only if either (a) the --global or -g option is specified, or (b) the input lines are sorted.
Options
The following options are supported:
-c | --count | Precedes each output line with a count of the number of times the line occurred in the input. | |||
-d | --duplicatedOnly | Suppresses the writing of lines that are not repeated in the input. | |||
-u | --uniqueOnly | Suppresses the writing of lines that are repeated in the input. | |||
-g | --global | Suppresses repeated lines globally, that is, if lines are non-adjacent. This option guarantees unique output lines even if the input lines are not sorted. |
OPERANDS
The following operands are supported:
<file> | : | java.io.File | The files or directories used as starting point for the listing; relative paths are not resolved (use the string path argument to enable relative path resolving based on the current working directory). | ||
<path> | : | String | The files or directories used as starting point for the listing; wildcards * and ? are supported; relative paths are resolved on the basis of the current working directory. | ||
<args> | : | 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 "--path" operand have to be prefixed with the operand name. | ||
<options> | : | UniqOptions | The options defining the uniqueness details for the output lines. |
Modifier and Type | Class and Description |
---|---|
static interface |
Uniq.Interface<R>
Interface defining all method signatures for the "uniq" command.
|
Modifier and Type | Field and Description |
---|---|
static UniqFactory |
Factory
Singleton
factory instance for the "uniq" command. |
static String |
NAME
The "uniq" command name.
|
static UniqOptionSets |
Options
|
public static final String NAME
public static final UniqOptionSets Options
c
, d
, u
, g
.
-c | --count | Precedes each output line with a count of the number of times the line occurred in the input. | |||
-d | --duplicatedOnly | Suppresses the writing of lines that are not repeated in the input. | |||
-u | --uniqueOnly | Suppresses the writing of lines that are repeated in the input. | |||
-g | --global | Suppresses repeated lines globally, that is, if lines are non-adjacent. This option guarantees unique output lines even if the input lines are not sorted. |
public static final UniqFactory Factory
factory
instance for the "uniq" command.Copyright © 2024. All rights reserved.