aboutsummaryrefslogtreecommitdiff
path: root/ja/man/man1/cut.1
blob: 44ab0bdae32fcde147dc35a4f7d56d5ba93811d6 (plain) (blame)
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
.\"	%NetBSD: cut.1,v 1.5 1995/03/26 20:51:25 glass Exp %
.\"
.\" Copyright (c) 1989, 1990, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" the Institute of Electrical and Electronics Engineers, Inc.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"     @(#)cut.1	8.1 (Berkeley) 6/6/93
.\" jpman %Id: cut.1,v 1.2 1997/03/29 02:27:38 horikawa Stab %
.\"
.Dd June 6, 1993
.Dt CUT 1
.Os
.Sh 名称
.Nm cut
.Nd ファイルの各行の、指定した部分を取り出す
.Sh 書式
.Nm cut
.Fl c Ar list
.Ar
.Nm cut
.Fl f Ar list
.Op Fl d Ar delim
.Op Fl s
.Ar
.Sh 解説
.Nm cut
は、
.Ar file
が指定されていればそのファイルから、指定されていなければ標準入力から
行を読み込み、
.Ar list
の指定に従って選択した部分を取り出して標準出力に出力します。
.Ar list
には、カラム番号、もしくはフィールド番号を指定します。
フィールドは特定の文字で区切られた領域です。
カラム番号およびフィールド番号は 1 から始まります。
.\" フィールド番号が 1 から始まるという記述はオリジナルには無いですが、
.\" 分かりやすくするために補足しました。
.\" By horikawa@isrd.hitachi.co.jp (Nov 9 1996)
.Pp
.Ar list
には、コンマ (,) もしくは空白で区切られた
複数の増加方向の番号もしくは番号範囲を指定することができます。
番号範囲は、1 番目の番号、ダッシュ
.Pq Li \-
、2 番目の番号の 3 つの組から構成され、
1 番目の番号から 2 番目の番号までの複数のフィールドもしくは複数のカラムを
選択します。
範囲には 1 番目の番号および 2 番目の番号も含まれます。
番号もしくは番号範囲の前にダッシュをつけた場合には、
1 番目の番号までのすべてのフィールドもしくはカラムも選択します。
番号もしくは番号範囲の後にダッシュをつけた場合には、
最後の番号以降のすべてのフィールドもしくはカラムも選択します。
番号もしくは番号範囲は、
繰り返しても、重なっても、いかなる順番であっても構いません。
また、入力行に指定のフィールドやカラムがない場合、
エラーとはなりません。
.Pp
オプションとしては以下のものがあります:
.Bl -tag -width Fl
.It Fl c Ar list
文字単位で指定します。
.It Fl d Ar delim
フィールドを区切る文字として
.Ar delim
を使用します。デフォルトではタブが使用
されます。
.It Fl f Ar list
タブで区切られたフィールド単位で指定します。
出力フィールドはタブで区切られます。
.It Fl s
区切り文字のない行を出力しないようにします。このオプションが
指定されてない場合、区切り文字がない行はそのまま出力されます。
.El
.Pp
成功した場合は 0 を、エラーが起きた場合は 1 を返します。
.Sh 関連項目
.Xr paste 1
.Sh 標準
.Nm cut
は
.St -p1003.2
準拠です。