'\" te .\" Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. .\" Copyright 1989 AT&T .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures .\" 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 cat 1 "2011 年 7 月 25 日" "SunOS 5.11" "ユーザーコマンド" .SH 名前 cat \- ファイルの連結と表示 .SH 形式 .LP .nf \fB/usr/bin/cat\fR [\fB-nbsuvet\fR] [\fIfile\fR...] .fi .SH 機能説明 .sp .LP \fBcat\fR ユーティリティーは \fIfile\fR を指定された順に読み込み、標準出力に出力します。したがって、 .sp .in +2 .nf example% \fBcat file\fR .fi .in -2 .sp .sp .LP は、\fIfile\fR を端末に出力します。 .sp .in +2 .nf example% \fBcat file1 file2 >file3\fR .fi .in -2 .sp .sp .LP は、\fIfile1\fR と \fIfile2\fR を連結して、結果を \fIfile3\fR に出力します。入力ファイルが指定されなかったときは、\fBcat\fR は標準入力ファイルから読み込みます。 .SH オプション .sp .LP \fB/usr/bin/cat\fR では次のオプションを使用できます。 .sp .ne 2 .mk .na \fB\fB-b\fR\fR .ad .RS 6n .rt \fB-n\fR と同様に行番号を振ります。ただし、空行は数えません。 .RE .sp .ne 2 .mk .na \fB\fB-n\fR\fR .ad .RS 6n .rt 各出力行の前に、行番号を振ります。 .RE .sp .ne 2 .mk .na \fB\fB-s\fR\fR .ad .RS 6n .rt \fBcat\fR は、ファイルが存在しないとき何もしません。 .RE .sp .ne 2 .mk .na \fB\fB-u\fR\fR .ad .RS 6n .rt 出力はバッファリングされません .sp デフォルトでは、出力はバッファリングされます。 .RE .sp .ne 2 .mk .na \fB\fB-v\fR\fR .ad .RS 6n .rt タブを除く非印刷文字、NEWLINE、およびフォームフィードが明確に出力されます。ASCII 制御文字 (8 進数の \fB000\fR から \fB037\fR) は \fB^\fR\fIn\fR として出力されます。ここで \fIn\fR は、8 進数の 100 から 137 の範囲の対応する ASCII 文字 (@、A、B、C、. . .、X、Y、Z、[、\、]、^、および _) です。\fBDEL\fR 文字 (8 進数の \fB0177\fR) は \fB^?\fR として出力されます。その他の非印字文字は \fBM-\fR\fIx\fR として出力されます。ここで \fIx\fR は、下位 7 ビットで指定される ASCII 文字です。 .RE .sp .LP \fB-v\fR オプションを使用した場合、次のオプションも使用できます。 .sp .ne 2 .mk .na \fB\fB-e\fR\fR .ad .RS 6n .rt \fB$\fR 記号が各行の最後 (NEWLINE の前) に出力されます。 .RE .sp .ne 2 .mk .na \fB\fB-t\fR\fR .ad .RS 6n .rt タブは \fB^I\fR として、フォームフィードは \fB^L\fR としてそれぞれ出力されます。 .RE .sp .LP \fB-e\fR オプションおよび \fB-t\fR オプションは、\fB-v\fR オプションが指定されていなければ無視されます。 .SH オペランド .sp .LP 次のオペランドを指定できます。 .sp .ne 2 .mk .na \fB\fIfile\fR\fR .ad .RS 8n .rt 入力ファイルのパス名。\fIfile\fR の指定がない場合は、標準入力を使用します。\fIfile\fR が \fB - \fR である場合、\fBcat\fR は、シーケンス内のその時点で標準入力から読み取ります。\fBcat\fR は、このように参照されても標準入力を閉じたり、再度開いたりすることはなく、\fB - \fR が \fIfile\fR として複数回現れることを受け入れます。 .RE .SH 使用法 .sp .LP 2G バイト (2^31 バイト) 以上のファイルを検出した場合の \fBcat\fR の動作については、\fBlargefile\fR(5) を参照してください。 .SH 使用例 .LP \fB例 1 \fRファイルを連結する .sp .LP 次のコマンドは、\fBmyfile\fR というファイルの内容を標準出力に書き出します。 .sp .in +2 .nf example% \fBcat myfile\fR .fi .in -2 .sp .LP \fB例 2 \fR2 つのファイルを 1 つのファイルに連結する .sp .LP 次のコマンドは、ファイル \fBdoc1\fR と \fBdoc2\fR を連結し、その結果を \fBdoc.all\fR に書き込みます。 .sp .in +2 .nf example% \fBcat doc1 doc2 > doc.all\fR .fi .in -2 .sp .LP \fB例 3 \fRcat の呼び出し 1 回で 2 組の入力を連結する .sp .LP このコマンドは、標準入力が端末の場合に、1 回の \fBcat\fR の呼び出しで端末から 2 組の入力データを取得します。 .sp .in +2 .nf example% \fBcat start - middle - end > file\fR .fi .in -2 .sp .sp .LP このコマンドは、標準入力が端末の場合には、1 回の \fBcat\fR の呼び出しで、端末から 2 組の入力データを得るものです。 .sp .LP 標準入力が通常ファイルの場合、 .sp .in +2 .nf example% \fBcat start - middle - end > file\fR .fi .in -2 .sp .sp .LP 次のコマンドと同等になります。 .sp .in +2 .nf \fBcat start - middle /dev/null end > file\fR .fi .in -2 .sp .sp .LP これは、\fB - \fR がはじめて \fIfile\fR オペランドとして使用されたときに \fBcat\fR によってファイルの内容全体が消費され、2 回目に \fB - \fR が参照されるとただちにファイルの終わりが検出されるためです。 .SH 環境 .sp .LP \fBcat\fR の実行に影響を与える環境変数 \fBLANG\fR、\fBLC_ALL\fR、\fBLC_CTYPE\fR、\fBLC_MESSAGES\fR、および \fBNLSPATH\fR については、\fBenviron\fR(5) を参照してください。 .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 \fBtouch\fR(1), \fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5) .SH 注意事項 .sp .LP \fBcat\fR の出力先を入力中のファイルに変更すると、入力ファイルのデータが失われます。たとえば、 .sp .in +2 .nf example% \fBcat filename1 filename2 > filename1\fR .fi .in -2 .sp .sp .LP この例では \fBfilename1\fR の元データが失われます。