uniq - ファイルの中の重複行の報告またはフィルタへの出力
/usr/bin/uniq [ [-c | --count] | [-d | --repeated] | [-u | --unique] | [-D[delimit-method] | --all-repeated[=delimit-method]] ] [-f fields | --skip-fields=fields] [-s chars |--skip-chars=chars] [-w | --check-chars=chars] [-i | --ignore-case] [-z | --zero-terminated] [input_file [output_file]]
/usr/bin/uniq [ [-c | --count] | [-d | --repeated] | [-u | --unique] | [-D[delimit-method] | --all-repeated[=delimit-method]] ] [-f fields | --skip-fields=fields] [-s chars |--skip-chars=chars] [-w | --check-chars=chars] [-i | --ignore-case] [-z | --zero-terminated] [-n] [+m][input_file [output_file]]
/usr/bin/uniq --help
uniq は、入力を読み取り、隣接する行を比較して、各入力行のコピーを 1 行ずつ出力に書き込みます。隣接する重複行の 2 番目以降の行は書き込まれません。
出力ファイル output_file が指定されていない場合、uniq は標準出力に書き込みます。input_file が指定されていない場合、または input_file が - の場合、uniq は、現在のオフセットをファイルの開始位置として定義し、標準入力から読み取ります。
サポートしているオプションは、次のとおりです。
各行の先頭に、その行が入力中に連続して現れた回数を出力します。
入力中で重複していなかった行は出力しません。
次のいずれかの区切り方法を使用して、重複した行のグループを区切ります。
区切り操作は行われません。
各グループの前に区切り文字を付けます。
区切り文字でグループを分けます。
空白の行を使用して区切り操作が行われます。
Ignores the first fields fields on each input line when doing comparisons, where fields is a positive decimal integer.field は、基本的な正規表現で一致する最大の文字列です。
[[:blank:]]*[^[:blank:]]*
If fields specifies more fields than appear on an input line, a null string are used for comparison.
比較のときに大文字と小文字の違いを無視します。
比較を行う際に、最初の chars 文字を無視します。chars は正の整数です。If specified in conjunction with the –f option, the first chars characters after the first fields fields are ignored.If chars specifies more characters than remain on an input line, a null string are used for comparison.
入力中で重複していた行は出力しません。
Compare no more than char characters in a line.
新しい行ではなく、0 バイトで行を終わらせます。
fields の値が n である –f fields 指定と同じ意味です。
chars の値が m である –s chars 指定と同じ意味です。
コマンドの使用法を表示して終了します。
次のオペランドがサポートされています。
入力ファイルのパス名。input_file が指定されない場合、または input_file が - の場合は、標準入力が使用されます。
出力ファイルのパス名。output_file が指定されない場合、標準出力が使用されます。input_file と同じファイルを output_file で指定した場合、処理の結果は予測できません。
次の例では uniq.test ファイルの内容をリストで示し、重複行を出力しています。
example% cat uniq.test This is a test. This is a test. TEST. Computer. TEST. TEST. Software. example% uniq -d uniq.test This is a test. TEST. example%
次の例では uniq.test ファイルで重複していない行だけを出力しています。
example% uniq -u uniq.test TEST. Computer. Software. example%
最後の例では、ファイルの中でそれぞれの行が現われた回数を 各行の先頭に付けて出力しています。
example% uniq -c uniq.test 2 This is a test. 1 TEST. 1 Computer. 2 TEST. 1 Software. example%
uniq の実行に影響を与える次の環境変数についての詳細は、environ(7) を参照してください。LANG、LC_ALL、LC_CTYPE、LC_MESSAGES、および NLSPATH。
次の終了ステータスが返されます。
正常終了。
エラーが発生しました。
属性についての詳細は、マニュアルページの attributes(7) を参照してください。
|