uniq
uniq功能说明:检查及删除文本文件中重复出现的行列。
语 法:uniq [-cdu][-f<栏位>][-s<字符位置>][-w<字符位置>][--help][--version][输入文件][输出文件]
补充说明:uniq可检查文本文件中重复出现的行列。
参 数:
-c或--count 在每列旁边显示该行重复出现的次数。
-d或--repeated 仅显示重复出现的行列。
-f<栏位>或--skip-fields=<栏位> 忽略比较指定的栏位。
-s<字符位置>或--skip-chars=<字符位置> 忽略比较指定的字符。
-u或--unique 仅显示出一次的行列。
-w<字符位置>或--check-chars=<字符位置> 指定要比较的字符。
--help 显示帮助。
--version 显示版本信息。
[输入文件] 指定已排序好的文本文件。
[输出文件] 指定输出的文件。
uniq
uniq [options] [file1 [file2] ]
Remove duplicate adjacent lines from sorted file1 or from standard input, sending one copy of each line to file2 (or to standard output). Often used as a filter. Specify only one of -d or -u. See also comm and sort.
Options
Print each line once, prefixing number of instances.
Print duplicate lines once but no unique lines.
Print all duplicate lines. -D takes no delimiter method. The delimiter method method takes one of the following values: none (default), prepend, or separate. Blank lines are used as the delimiter.
Ignore first n fields of a line. Fields are separated by spaces or by tabs.
Ignore case differences when checking for duplicates.
Ignore first n characters of a field.
Print only unique lines (no copy of duplicate entries is kept).
Compare only first n characters per line (beginning after skipped fields and characters).
Print a help message and then exit.
Print version information and then exit.
Examples
Send one copy of each line from list to output file list.new:
uniq list list.new
Show which names appear more than once:
sort names | uniq -d