'\" te .\" Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. .\" Copyright 1989 AT&T .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/. .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html. This notice shall appear on any product containing this material. .TH uniq 1 "2011 年 7 月 28 日" "SunOS 5.11" "ユーザーコマンド" .SH 名前 uniq \- ファイルの中の重複行の報告またはフィルタへの出力 .SH 形式 .LP .nf \fB/usr/bin/uniq\fR [\fB-c\fR | \fB -d \fR | \fB -u \fR] [\fB -f \fR \fIfields\fR] [\fB-s\fR \fIchar\fR] [\fIinput_file\fR [\fIoutput_file\fR]] .fi .LP .nf \fB/usr/bin/uniq\fR [\fB-c\fR | \fB -d \fR | \fB -u \fR] [\fB-\fR\fIn\fR ] [\fB+\fR\fIm\fR ] [\fIinput_file\fR [\fIoutput_file\fR]] .fi .SH 機能説明 .sp .LP \fBuniq\fR は、入力を読み取り、隣接する行を比較して、各入力行のコピーを 1 行ずつ出力に書き込みます。隣接する重複行の 2 番目以降の行は書き込まれません。 .sp .LP 出力ファイル \fIoutput_file\fR が指定されていない場合、\fBuniq\fR は標準出力に書き込みます。\fIinput_file\fR が指定されていない場合、または \fIinput_file\fR が \fB-\fR の場合、\fBuniq\fR は、現在のオフセットをファイルの開始位置として定義し、標準入力から読み取ります。 .SH オプション .sp .LP サポートしているオプションは、次のとおりです。 .sp .ne 2 .mk .na \fB\fB-c\fR\fR .ad .RS 7n .rt 各行の先頭に、その行が入力中に連続して現れた回数を出力します。 .RE .sp .ne 2 .mk .na \fB\fB-d\fR\fR .ad .RS 7n .rt 入力中で重複していなかった行は出力しません。 .RE .sp .ne 2 .mk .na \fB\fB-f\fR \fR .ad .br .na \fB\fR .ad .RS 7n .rt 比較を行う際に、各入力行の最初の \fIfields\fR \fIfields\fR を無視します。\fIfields\fR は正の整数です。\fIfield\fR は、基本的な正規表現で一致する最大の文字列です。 .sp .in +2 .nf [[:blank:]]*[^[:blank:]]* .fi .in -2 .sp 入力行にあるより多くの \fIfields\fR を \fIfields\fR に指定した場合、比較には NULL 文字列が使われます。 .RE .sp .ne 2 .mk .na \fB\fB-s\fR\fR .ad .RS 7n .rt 比較を行う際に、最初の chars 文字を無視します。chars は正の整数です。\fB-f\fR オプションと一緒に指定した場合には、 先頭の \fIfields\fR \fIfields\fR のあとの chars 文字が無視されます。入力行に残っているより多くの文字を chars に指定した場合、比較には NULL 文字列が使われます。 .RE .sp .ne 2 .mk .na \fB\fB-u\fR\fR .ad .RS 7n .rt 入力中で重複していた行は出力しません。 .RE .sp .ne 2 .mk .na \fB\fB-\fR\fIn\fR\fR .ad .RS 7n .rt \fIfields\fR の値が \fIn\fR である \fB-f\fR \fIfields\fR 指定と同じ意味です。 .RE .sp .ne 2 .mk .na \fB\fB+\fR\fIm\fR \fR .ad .RS 7n .rt \fIchars\fR の値が \fIm\fR である \fB-s\fR \fIchars\fR 指定と同じ意味です。 .RE .SH オペランド .sp .LP 次のオペランドがサポートされています。 .sp .ne 2 .mk .na \fB\fIinput_file\fR \fR .ad .RS 16n .rt 入力ファイルのパス名。\fIinput_file\fR が指定されない場合、または \fIinput_file\fR が \fB-\fR の場合は、標準入力が使用されます。 .RE .sp .ne 2 .mk .na \fB\fIoutput_file\fR \fR .ad .RS 16n .rt 出力ファイルのパス名。\fIoutput_file\fR が指定されない場合、標準出力が使用されます。\fIinput_file\fR と同じファイルを \fIoutput_file\fR で指定した場合、処理の結果は予測できません。 .RE .SH 使用例 .LP \fB例 1 \fR\fBuniq\fR コマンドの使用 .sp .LP 次の例では \fBuniq.test\fR ファイルの内容をリストで示し、重複行を出力しています。 .sp .in +2 .nf example% \fBcat uniq.test\fR This is a test. This is a test. TEST. Computer. TEST. TEST. Software. example% \fBuniq -d uniq.test\fR This is a test. TEST. example% .fi .in -2 .sp .sp .LP 次の例では \fBuniq.test\fR ファイルで重複していない行だけを出力しています。 .sp .in +2 .nf example% \fBuniq -u uniq.test\fR TEST. Computer. Software. example% .fi .in -2 .sp .sp .LP 最後の例では、ファイルの中でそれぞれの行が現われた回数を 各行の先頭に付けて出力しています。 .sp .in +2 .nf example% \fBuniq -c uniq.test\fR 2 This is a test. 1 TEST. 1 Computer. 2 TEST. 1 Software. example% .fi .in -2 .sp .SH 環境 .sp .LP \fBuniq\fR の実行に影響を与える次の環境変数についての詳細は、\fBenviron\fR(5) を参照してください。\fBLANG\fR、\fBLC_ALL \fR、\fBLC_CTYPE\fR、\fBLC_MESSAGES\fR、および \fBNLSPATH\fR。 .SH 終了ステータス .sp .LP 次の終了ステータスが返されます。 .sp .ne 2 .mk .na \fB\fB0\fR\fR .ad .RS 6n .rt 正常終了。 .RE .sp .ne 2 .mk .na \fB>\fB0\fR\fR .ad .RS 6n .rt エラーが発生した。 .RE .SH 属性 .sp .LP 属性についての詳細は、マニュアルページの \fBattributes\fR(5) を参照してください。 .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . 属性タイプ属性値 _ 使用条件system/core-os _ CSI有効 _ インタフェースの安定性確実 _ 標準T{ \fBstandards\fR(5) を参照してください。 T} .TE .SH 関連項目 .sp .LP \fBcomm\fR(1), \fBpack\fR(1), \fBpcat\fR(1), \fBsort\fR(1), \fBuncompress\fR(1), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)