-
Notifications
You must be signed in to change notification settings - Fork 1
/
cat.1
116 lines (76 loc) · 3.57 KB
/
cat.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
CAT(1) Human68k ITA TOOLBOX User's Manual CAT(1)
名称
cat - ファイルを連結して出力する
形式
cat [ -nbsvetmqBCZ ] [ -- ] [ file ] ...
解説
cat は,各 file を順次読み取り,標準出力にそれを出力します.
つまり,
cat file1
では標準出力に file1 が出力され,
cat file1 file2
では file1 と file2 を連結したものが出力されます.
file が 1つも指定されていない場合,または file が‘-’である
場合には標準入力から読み取りを行います.file がオープンでき
ないときにはエラー・メッセージを標準エラー出力に出力して処理
を継続します.
cat に指定できるオプションを以下に示します.
-n 出力の各行の先頭に 1から始まる行番号を付加します.ここ
で,行とは ^J コードで区切られた文字列です.
-b -n オプションと同様に行番号を付加しますが,空の行は数え
ません.
-s 連続した複数の空行を1つの空行に替えて出力します.
-v 制御文字を印字可能文字に変換して出力します.たとえば
Control-X(16進数で 18)は ^X,DEL(16進数で 7F)は ^?
に変換されます.ただし復帰(^M),改行(^J),改ページ(^L),
水平タブ(^I) は変換されずにそのまま出力されます.
-e -v と同様に制御文字を変換し,さらに改行(^J または ^M^J)
の直前に $ を出力します.
-t -v と同様に制御文字を変換し,さらに水平タブも ^I に変換
して出力します.
-m -v と同様に制御文字を変換し,さらに非ASCII文字(文字コー
ドの最上位ビットが 1 である文字)も M- の後ろに下位7ビッ
トのコードの文字を続けた形に変換して出力します.たとえ
ばコード C1(16進)は M-A,コード 81(16進)は M-^A に
変換されます.
-q 指定した入力ファイルがオープンできないときのエラー・メッ
セージの表示を抑止します.
-B 決して ^J コードの ^M^J への変換を行いません.通常は,
出力が cooked モードのキャラクタ・デバイス(CON や PRN
など)である場合には,^M に続いていない ^J コードを
^M^J に変換して出力します.
-C -B オプションと逆に,^M に続いていない ^J コードを常に
^M^J に変換して出力します.
-Z いかなる入力からも,^Z (control-Z) コードを EOF と見な
して入力を打ち切ります.通常は,入力が cooked モードの
キャラクタ・デバイス(CON など)である場合にのみ,^D か
または ^Z を読み取ると,それを EOF コードと見なして入力
を打ち切ります.
-B オプションと -C オプションの両方が指定された場合は,最後
に指定された一方が有効となります.
関連事項
cp(1), head(1), more(1), pr(1), tail(1), tee(1), fish(1)
診断
何らかのエラーがあったときにはエラー・メッセージが標準エラー
出力に出力されます.
終了ステータスとしては,引数の記述に間違いがあった場合には 1,
各引数の処理中に何らかのエラーが 1度でもあった場合には 2,メ
モリ不足やディスクの容量不足など,システムの問題により正常に
実行ができなかった場合には 3,すべてが正常に終了したならば 0
が返ります.^C などによって中断したときの終了ステータスは OS
の仕様によります.
注意
シェルから cat file1 file2 > file1 のような形で実行すると,
cat が起動する前に file1 の内容が失われてしまうことになりま
す.シェルはコマンドを実行する前に入出力の切り替えを行うとい
うことに注意してください.
不具合
cooked モードのキャラクタ・デバイスからは,^D や ^Z を EOF
としてではなくデータとして入力することはできません.
CON からは行単位で入力されますので,^D あるいは ^Z の後にも
改行が必要です.
バージョン
1.5
制作・著作
Copyright(C)1991-94 by 板垣 史彦 (Itagaki Fumihiko)
1.5 Last change: 03 Jan 1993 Itagaki Fumihiko