2 .\" sed.1 - the *roff document processor source for the sed manual
4 .\" This file is part of GNU sed.
5 .\" Copyright (C) 1998 Free Software Foundation, Inc.
7 .\" This program is free software; you can redistribute it and/or modify
8 .\" it under the terms of the GNU General Public License as published by
9 .\" the Free Software Foundation; either version 2, or (at your option)
10 .\" any later version.
12 .\" This program is distributed in the hope that it will be useful,
13 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
14 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 .\" GNU General Public License for more details.
17 .\" You should have received a copy of the GNU General Public License
18 .\" along with this program; if not, write to the Free Software
19 .\" Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
21 .\" Japanese Version Copyright (c) 2001 NAKANO Takeo all rights reserved.
22 .\" Translated Mon 7 May 2001 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
24 .TH SED 1 "1998-05-07" "GNU Project"
28 .\"O sed \- a Stream EDitor
34 sed [-n] [-V] [--quiet] [--silent] [--version] [--help]
35 [-e script] [--expression=script]
36 [-f script-file] [--file=script-file]
37 [script-if-no-other-script]
42 .\"O \*(Sd is a stream editor.
43 .\"O A stream editor is used to perform basic text
44 .\"O transformations on an input stream
45 .\"O (a file or input from a pipeline).
46 .\"O While in some ways similar to an editor which
47 .\"O permits scripted edits (such as \fIed\fP),
48 .\"O \*(sd works by making only one pass over the
49 .\"O input(s), and is consequently more efficient.
50 .\"O But it is \*(sd's ability to filter text in a pipeline
51 .\"O which particularly distinguishes it from other types of
56 に対して基本的なテキスト変換を行うために用いられる。
58 編集スクリプトを使える (\fIed\fP のような) エディタと
60 \*(sd は入力に対して 1 パスだけで動作するので、より効率的である。
61 また \*(sd はパイプラインのテキストに対してフィルタ動作を行うことができ、
62 この点は他のタイプのエディタとはっきり違う。
66 .\"O \*(Sd may be invoked with the following command-line options:
67 \*(sd の起動時には以下のコマンドラインオプションを指定できる。
72 .\"O Print out the version of sed that is being run and a copyright notice,
74 sed のバージョン・著作権表示を出力し、終了する。
79 .\"O Print a usage message briefly summarizing these command-line options
80 .\"O and the bug-reporting address,
82 コマンドラインオプションを簡単にまとめた利用法と
83 バグレポート先のアドレスを出力し、終了する。
90 .\"O By default, \*(sd will print out the pattern space
91 .\"O at the end of each cycle through the script.
92 .\"O These options disable this automatic printing,
93 .\"O and \*(sd will only produce output when explicitly told to
98 \*(sd はスクリプトの各サイクルの最後でパターンスペースの内容を出力する。
99 これらのオプションを指定するとこの自動的な出力が行われなくなり、
101 コマンドで出力することを指定された場合に限って
106 .BI --expression= script
107 .\"O Add the commands in
109 .\"O to the set of commands to be run while processing the input.
111 のコマンドを、入力の処理中に行われるコマンドセットに追加する。
113 .B -f \fIscript-file\fP
115 .BI --file= script-file
116 .\"O Add the commands contained in the file
118 .\"O to the set of commands to be run while processing the input.
121 に含まれるコマンドを、入力の処理中に行われるコマンドセットに追加する。
124 .\"O .BR -e , -f , --expression ,
127 .\"O options are given on the command-line,
128 .\"O then the first non-option argument on the command line is
132 .BR -e ", " -f ", " --expression ", " --file
133 などのオプションがコマンドラインから全く与えられなかった場合は、
134 コマンドラインの引き数のうち、オプションでない最初のものが
138 .\"O If any command-line parameters remain after processing the above,
139 .\"O these parameters are interpreted as the names of input files to
143 .\"O refers to the standard input stream.
144 .\"O The standard input will processed if no file names are specified.
145 以上のコマンドラインパラメータを処理したあとに引き数が残った場合は、
146 それらは処理対象となる入力ファイルのファイル名と解釈される。
148 というファイル名は、標準入力ストリームを参照する。
149 ファイル名が全く指定されなかった場合は標準入力を処理する。
152 .\"O Command Synopsis
154 .\"O This is just a brief synopsis of \*(sd commands to serve as
155 .\"O a reminder to those who already know sed;
156 .\"O other documentation (such as the texinfo document)
157 .\"O must be consulted for fuller descriptions.
158 これは \*(sd コマンドのごく簡単な文法で、
159 既に sed を知っている人に対する備忘録程度のものである。
160 完全な記述を求める場合は他の文書 (texinfo 文書など) にあたること。
162 .\"O Zero-address ``commands''
177 .\"O The comment extends until the next newline (or the end of a
179 .\"O script fragment).
182 スクリプトフラグメントの末尾まで) をコメントとして取り扱う。
185 .\"O The closing bracket of a { } block.
188 .\"O Zero- or One- address commands
189 .SS アドレスを 0 または 1 個とるコマンド
192 .\"O Print the current line number.
200 .\"O which has each embedded newline preceeded by a backslash.
204 に改行を含めたい場合は、その前にバックスラッシュを置く。
211 .\"O which has each embedded newline preceeded by a backslash.
215 に改行を含めたい場合は、その前にバックスラッシュを置く。
218 .\"O Immediately quit the \*(sd script without processing
220 .\"O except that if auto-print is not diabled
221 .\"O the current pattern space will be printed.
222 これ以上入力の処理を行わず、ただちに \*(sd スクリプトの処理を終了する。
223 ただし auto-print が diable されていなければ、
227 .\"O Append text read from
233 .\"O Commands which accept address ranges
237 .\"O Begin a block of commands (end with a }).
238 コマンドブロックの開始 (} で終了する)。
245 .\"O is omitted, branch to end of script.
249 が省略された場合は、スクリプトの末尾に分岐する。
252 .\"O If a s/// has done a successful substitution since the
253 .\"O last input line was read and since the last t command,
258 .\"O is omitted, branch to end of script.
259 最後に入力行が読まれ、最後に t コマンドが行われて以降に
264 が省略された場合は、スクリプトの末尾に分岐する。
269 .\"O Replace the selected lines with
271 .\"O which has each embedded newline preceeded by a backslash.
276 に改行を含めたい場合は、その前にバックスラッシュを置く。
279 .\"O Delete pattern space.
280 .\"O Start next cycle.
285 .\"O Delete up to the first embedded newline in the pattern space.
286 .\"O Start next cycle, but skip reading from the input
287 .\"O if there is still data in the pattern space.
288 パターンスペースの最初の改行までを削除する。
290 パターンスペースにまだデータが残っていたら、
294 .\"O Copy/append pattern space to hold space.
295 パターンスペースをホールドスペースにコピー/追加する。
298 .\"O Copy/append hold space to pattern space.
299 ホールドスペースをパターンスペースにコピー/追加する。
302 .\"O Exchange the contents of the hold and pattern spaces.
303 ホールドスペースとパターンスペースの内容を交換する。
306 .\"O List out the current line in a ``visually unambiguous'' form.
307 現在の行を「視覚的に紛れのない」形式でリストする。
310 .\"O Read/append the next line of input into the pattern space.
311 入力の次の行をパターンスペースに読み込む/追加する。
314 .\"O Print the current pattern space.
318 .\"O Print up to the first embedded newline of the current pattern space.
319 現在のパターンスペースの最初の改行までを出力する。
321 .RI s/ regexp / replacement /
322 .\"O Attempt to match
324 .\"O against the pattern space.
328 .\"O If successful, replace that portion matched
330 .\"O .IR replacement .
336 .\"O may contain the special character
338 .\"O to refer to that portion of the pattern space which matched,
339 .\"O and the special escapes \e1 through \e9 to refer to the
340 .\"O corresponding matching sub-expressions in the
345 を含むことができ、これはパターンスペースのマッチした部分を参照する。
346 また \e1 から \e9 までの特殊エスケープを含むこともでき、
349 の副表現 (sub-expression) にマッチした部分をそれぞれ参照する。
353 .\"O Write the current pattern space to
359 .RI y/ source / dest /
360 .\"O Transliterate the characters in the pattern space which appear in
362 .\"O to the corresponding character in
372 .\"O \*(Sd commands can be given with no addresses, in which
373 .\"O case the command will be executed for all input lines;
374 .\"O with one address, in which case the command will only be executed
375 .\"O for input lines which match that address; or with two
376 .\"O addresses, in which case the command will be executed
377 .\"O for all input lines which match the inclusive range of
378 .\"O lines starting from the first address and continuing to
379 .\"O the second address.
380 \*(sd のコマンドはアドレスを指定せずに与えることもでき、
381 この場合そのコマンドはすべての入力行に対して実行される。
383 コマンドはそのアドレスにマッチした入力行に対してのみ実行される。
384 2 つのアドレスを与えると、最初のアドレスにマッチした行から、
385 2 番目のアドレスにマッチした行に至る範囲 (両マッチ行を含む)
387 .\"O Three things to note about address ranges:
389 .\"O .IR addr1 , addr2
390 .\"O (i.e., the addresses are separated by a comma);
393 .\"O matched will always be accepted,
396 .\"O selects an earlier line;
401 .\"O it will not be tested against the line that
404 アドレスの範囲指定については 3 つのことを注意しておく。
407 である (つまりアドレスをコンマで区切る)。
411 がより前の行にマッチした場合でも、常に処理対象となる。
421 .\"O After the address (or address-range),
422 .\"O and before the command, a
424 .\"O may be inserted,
425 .\"O which specifies that the command shall only be
426 .\"O executed if the address (or address-range) does
429 アドレス (あるいはアドレス範囲) とコマンドの間には
431 を挟むことができる。この場合は、アドレス (あるいはアドレス範囲) が
432 \fBマッチしなかった\fP行に対してのみコマンドが実行される。
434 .\"O The following address types are supported:
435 以下のアドレスタイプがサポートされている。
438 .\"O Match only the specified line
446 .\"O line starting with line
448 .\"O For example, ``sed -n 1~2p'' will print all the odd-numbered lines in
449 .\"O the input stream, and the address 2~5 will match every fifth line,
450 .\"O starting with the second.
451 .\"O (This is a GNU extension.)
455 行おきの行にマッチする。例えば ``sed -n 1~2p'' は
456 入力行のうち奇数行を表示し、アドレスを 2~5 にすると、
457 第 2 行から 5 行おきに表示する (これは GNU の拡張である)。
460 .\"O Match the last line.
464 .\"O Match lines matching the regular expression
470 .BI \fR\e\fPc regexp c
471 .\"O Match lines matching the regular expression
475 .\"O may be any character.
483 .\"O Regular expressions
487 .\"O be supported, but they aren't completely yet.
490 .\"O sequence in a regular expression matches the newline character.
491 .\"O There are also some GNU extensions.
492 .\"O [XXX FIXME: more needs to be said.
493 .\"O At the very least, a reference to another document which
494 .\"O describes what is supported should be given.]
496 をサポートすべきであるが、まだ完全にはサポートできていない。
501 [要修正: より詳細を記述する必要がある。
502 少なくとも、何がサポートされているかを述べた、
505 .\"O Miscellaneous notes
507 .\"O This version of sed supports a
508 .\"O .RB \e <newline>
510 .\"O all regular expressions, the
512 .\"O part of a substitute (s) command, and in the
516 .\"O parts of a transliterate (y) command.
517 .\"O The \e is stripped, and the newline is kept.
541 .\"O to be written... XXX],
547 .\"O any of various books on \*(sd,
550 the \*(sd FAQ (http://www.wollery.demon.co.uk/sedtut10.txt,
551 http://www.ptug.org/sed/sedfaq.htm).
556 .\"O E-mail bug reports to
557 .\"O .BR bug-gnu-utils@gnu.org .
558 .\"O Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.
560 .B bug-gnu-utils@gnu.org
563 「sed」という単語を入れるようにして欲しい。