Previous Table of Contents Next


sort

Sort-Merge Files

     $sort [–cmu] [–ofile] [–yk] [–zn][–dfiMnr][–btc]
              [ +pos1 pos2  ]] [ files ]

Description:

The sort command sorts lines from files.

Options:

–b ignore leading tabs and spaces
–c check that the input is in sorted order
–d sort in dictionary order; only letters, digits, and white-space are significant in comparisons
–f sort upper and lower case letters together
–i ignore non-printable characters
–m merge already sorted files
–M sort as months. The first three non-blank characters are converted to upper case and compared. (implies –b)
–n sort by numerical value; blanks, minus signs, and decimal points can also be given (implies –b)
–ofile send output to file (default standard output)
–r reverse the sorting order
–tc set the field separator to c
–u display only one occurrence of duplicate lines
–y[k] use k kilobytes of memory to sort (default max)
–zn use n bytes of buffer for long lines
files read standard input if files is or no files given
+pos1 [ pos2] sort from pos1 to pos2.
If pos2 is not specified, sort from pos1 to the end of line. The format for pos1 and pos2 is: m[.n] [bdfinr]
m m fields from start of line (default 0)
n n characters from start of field (default 0)
bdfinr option applies to the specified key only

tr

Translate Characters

    $tr [–cds] [string1] [string2]

Description:

The tr command copies standard input to output and translates characters from string1 to characters in string2.

Options:

–c translate characters not in string1
–d delete characters in string1 from input
–s truncate repeated characters from string2

Strings:

[az] specifies range of characters from a to z
[c*n] specifies n repetitions of c. If the first digit in n is 0, n interpreted as octal. (default decimal)

uniq

Report Duplicate Lines

    $uniq [ –udc [ +n ] [ n ] ] [ file1 [ file2 ] ]

Description:

The uniq command removes duplicate adjacent lines from file1 and places the output in file2.

Options:

–c display a count of duplicate lines also
–d display only duplicate lines once
–u display only unique lines from the original file
n skip first n fields from start of line
+n skip first n characters from the start of field


Previous Table of Contents Next
1