sort
Use sort
as follows:
1
sort [options] -k<field_start[type][,field_end[type]]> [...] <input-source>
The field_start
denotes the start column to sort by, and the optional
field_end
denotes the end column to sort by. If there is no -k
, then
it’s sorted on the entire line. type
is a subset of options. All options
are like:
n
: denotes to treat as numberr
: denotes to sort in reverse orders
: denotes to sort stablyf
: denotes to sort case insensitivelyb
: denotes to ignore blanko
: denotes the output fileu
: denotes theuniq
t
: denotes the separatorR
: denotes to sort randomlyc
: check if sortedm
: merge sorted inputs
If multiple <input-source>
s are provided, the output will be the merged
sorted result.
uniq
It works only when the duplicate lines are adjacent.
1
uniq [options] <input-source>
The options are like:
c
: count the duplicatesd
: print only duplicatesD
: print duplicates all occurrencesu
: print only uniqsw <num>
: compare with<num>
limited first characterss <num>
: skip comparing with first<num>
charactersf <num>
: avoid comparing with first<num>
fields
tee
It reads standard input and writes it to both standard output and files.
1
tee [options] <file> [...]
The options are like:
a
: append modei
: ignore interrupt