From 2e4dc2f76d5a13ac84ad2d36b0f75362e9c612a0 Mon Sep 17 00:00:00 2001 From: Akihiro MOTOKI Date: Mon, 1 Apr 2013 18:13:51 +0900 Subject: [PATCH] sed: Update original to GNU sed 4.2.2 --- manual/GNU_sed/original/man1/sed.1 | 367 +++++++++++++++++++++---------------- manual/GNU_sed/translation_list | 2 +- 2 files changed, 211 insertions(+), 158 deletions(-) diff --git a/manual/GNU_sed/original/man1/sed.1 b/manual/GNU_sed/original/man1/sed.1 index 870bab56..440287a1 100644 --- a/manual/GNU_sed/original/man1/sed.1 +++ b/manual/GNU_sed/original/man1/sed.1 @@ -1,36 +1,13 @@ -.\" -.\" sed.1 - the *roff document processor source for the sed manual -.\" -.\" This file is part of GNU sed. -.\" Copyright (C) 1998 Free Software Foundation, Inc. -.\" -.\" This program is free software; you can redistribute it and/or modify -.\" it under the terms of the GNU General Public License as published by -.\" the Free Software Foundation; either version 2, or (at your option) -.\" any later version. -.\" -.\" This program is distributed in the hope that it will be useful, -.\" but WITHOUT ANY WARRANTY; without even the implied warranty of -.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -.\" GNU General Public License for more details. -.\" -.\" You should have received a copy of the GNU General Public License -.\" along with this program; if not, write to the Free Software -.\" Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -.TH SED 1 "1998-05-07" "GNU Project" -.ds sd \fIsed\fP -.ds Sd \fISed\fP +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.28. +.TH SED "1" "December 2012" "sed 4.2.2" "User Commands" .SH NAME -sed \- a Stream EDitor +sed \- stream editor for filtering and transforming text .SH SYNOPSIS -.nf -sed [-n] [-V] [--quiet] [--silent] [--version] [--help] - [-e script] [--expression=script] - [-f script-file] [--file=script-file] - [script-if-no-other-script] - [file...] -.fi +.B sed +[\fIOPTION\fR]... \fI{script-only-if-no-other-script} \fR[\fIinput-file\fR]... .SH DESCRIPTION +.ds sd \fIsed\fP +.ds Sd \fISed\fP \*(Sd is a stream editor. A stream editor is used to perform basic text transformations on an input stream @@ -42,72 +19,71 @@ input(s), and is consequently more efficient. But it is \*(sd's ability to filter text in a pipeline which particularly distinguishes it from other types of editors. - -.SH OPTIONS -\*(Sd may be invoked with the following command-line options: -.TP -.B -V -.TP -.B --version -Print out the version of sed that is being run and a copyright notice, -then exit. -.TP -.B -h -.TP -.B --help -Print a usage message briefly summarizing these command-line options -and the bug-reporting address, -then exit. -.TP -.B -n -.TP -.B --quiet -.TP -.B --silent -By default, \*(sd will print out the pattern space -at the end of each cycle through the script. -These options disable this automatic printing, -and \*(sd will only produce output when explicitly told to -via the -.B p -command. -.TP -.B -e \fIscript\fP -.TP -.BI --expression= script -Add the commands in -.I script -to the set of commands to be run while processing the input. -.TP -.B -f \fIscript-file\fP -.TP -.BI --file= script-file -Add the commands contained in the file -.I script-file -to the set of commands to be run while processing the input. +.HP +\fB\-n\fR, \fB\-\-quiet\fR, \fB\-\-silent\fR +.IP +suppress automatic printing of pattern space +.HP +\fB\-e\fR script, \fB\-\-expression\fR=\fIscript\fR +.IP +add the script to the commands to be executed +.HP +\fB\-f\fR script-file, \fB\-\-file\fR=\fIscript\-file\fR +.IP +add the contents of script-file to the commands to be executed +.HP +\fB\-\-follow\-symlinks\fR +.IP +follow symlinks when processing in place +.HP +\fB\-i[SUFFIX]\fR, \fB\-\-in\-place\fR[=\fISUFFIX\fR] +.IP +edit files in place (makes backup if SUFFIX supplied) +.HP +\fB\-l\fR N, \fB\-\-line\-length\fR=\fIN\fR +.IP +specify the desired line-wrap length for the `l' command +.HP +\fB\-\-posix\fR +.IP +disable all GNU extensions. +.HP +\fB\-r\fR, \fB\-\-regexp\-extended\fR +.IP +use extended regular expressions in the script. +.HP +\fB\-s\fR, \fB\-\-separate\fR +.IP +consider files as separate rather than as a single continuous +long stream. +.HP +\fB\-u\fR, \fB\-\-unbuffered\fR +.IP +load minimal amounts of data from the input files and flush +the output buffers more often +.HP +\fB\-z\fR, \fB\-\-null\-data\fR +.IP +separate lines by NUL characters +.TP +\fB\-\-help\fR +display this help and exit +.TP +\fB\-\-version\fR +output version information and exit .PP -If no -.BR -e , -f , --expression , -or -.B --file -options are given on the command-line, -then the first non-option argument on the command line is -taken to be the -.I script -to be executed. +If no \fB\-e\fR, \fB\-\-expression\fR, \fB\-f\fR, or \fB\-\-file\fR option is given, then the first +non-option argument is taken as the sed script to interpret. All +remaining arguments are names of input files; if no input files are +specified, then the standard input is read. .PP -If any command-line parameters remain after processing the above, -these parameters are interpreted as the names of input files to -be processed. -A file name of -.B - -refers to the standard input stream. -The standard input will processed if no file names are specified. - -.SH -Command Synopsis +GNU sed home page: . +General help using GNU software: . +E-mail bug reports to: . +Be sure to include the word ``sed'' somewhere in the ``Subject:'' field. +.SH "COMMAND SYNOPSIS" This is just a brief synopsis of \*(sd commands to serve as -a reminder to those who already know sed; +a reminder to those who already know \*(sd; other documentation (such as the texinfo document) must be consulted for fuller descriptions. .SS @@ -138,24 +114,34 @@ a \e .I text Append .IR text , -which has each embedded newline preceeded by a backslash. +which has each embedded newline preceded by a backslash. .TP i \e .TP .I text Insert .IR text , -which has each embedded newline preceeded by a backslash. +which has each embedded newline preceded by a backslash. +.TP +q [\fIexit-code\fR] +Immediately quit the \*(sd script without processing +any more input, except that if auto-print is not disabled +the current pattern space will be printed. The exit code +argument is a GNU extension. .TP -q +Q [\fIexit-code\fR] Immediately quit the \*(sd script without processing -any more input, -except that if auto-print is not diabled -the current pattern space will be printed. +any more input. This is a GNU extension. .TP .RI r\ filename Append text read from .IR filename . +.TP +.RI R\ filename +Append a line read from +.IR filename . +Each invocation of the command reads a line from the file. +This is a GNU extension. .SS Commands which accept address ranges .TP @@ -169,30 +155,22 @@ if .I label is omitted, branch to end of script. .TP -.RI t\ label -If a s/// has done a successful substitution since the -last input line was read and since the last t command, -then branch to -.IR label ; -if -.I label -is omitted, branch to end of script. -.TP c \e .TP .I text Replace the selected lines with .IR text , -which has each embedded newline preceeded by a backslash. +which has each embedded newline preceded by a backslash. .TP d Delete pattern space. Start next cycle. .TP D -Delete up to the first embedded newline in the pattern space. -Start next cycle, but skip reading from the input -if there is still data in the pattern space. +If pattern space contains no newline, start a normal new cycle as if +the d command was issued. Otherwise, delete text in the pattern +space up to the first newline, and restart cycle with the resultant +pattern space, without reading a new line of input. .TP h H Copy/append pattern space to hold space. @@ -200,12 +178,15 @@ Copy/append pattern space to hold space. g G Copy/append hold space to pattern space. .TP -x -Exchange the contents of the hold and pattern spaces. -.TP l List out the current line in a ``visually unambiguous'' form. .TP +.RI l\ width +List out the current line in a ``visually unambiguous'' form, +breaking it at +.I width +characters. This is a GNU extension. +.TP n N Read/append the next line of input into the pattern space. .TP @@ -231,11 +212,37 @@ and the special escapes \e1 through \e9 to refer to the corresponding matching sub-expressions in the .IR regexp . .TP -w -.I filename +.RI t\ label +If a s/// has done a successful substitution since the +last input line was read and since the last t or T +command, then branch to +.IR label ; +if +.I label +is omitted, branch to end of script. +.TP +.RI T\ label +If no s/// has done a successful substitution since the +last input line was read and since the last t or T +command, then branch to +.IR label ; +if +.I label +is omitted, branch to end of script. This is a GNU +extension. +.TP +.RI w\ filename Write the current pattern space to .IR filename . .TP +.RI W\ filename +Write the first line of the current pattern space to +.IR filename . +This is a GNU extension. +.TP +x +Exchange the contents of the hold and pattern spaces. +.TP .RI y/ source / dest / Transliterate the characters in the pattern space which appear in .I source @@ -282,7 +289,10 @@ The following address types are supported: .TP .I number Match only the specified line -.IR number . +.IR number +(which increments cumulatively across files, unless the +.B -s +option is specified on the command line). .TP .IR first ~ step Match every @@ -292,7 +302,10 @@ line starting with line For example, ``sed -n 1~2p'' will print all the odd-numbered lines in the input stream, and the address 2~5 will match every fifth line, starting with the second. -(This is a GNU extension.) +.I first +can be zero; in this case, \*(sd operates as if it were equal to +.IR step . +(This is an extension.) .TP $ Match the last line. @@ -307,52 +320,92 @@ Match lines matching the regular expression The .B c may be any character. -.SH -Regular expressions +.PP +GNU \*(sd also supports some special 2-address forms: +.TP +.RI 0, addr2 +Start out in "matched first address" state, until +.I addr2 +is found. +This is similar to +.RI 1, addr2 , +except that if +.I addr2 +matches the very first line of input the +.RI 0, addr2 +form will be at the end of its range, whereas the +.RI 1, addr2 +form will still be at the beginning of its range. +This works only when +.I addr2 +is a regular expression. +.TP +.IR addr1 ,+ N +Will match +.I addr1 +and the +.I N +lines following +.IR addr1 . +.TP +.IR addr1 ,~ N +Will match +.I addr1 +and the lines following +.I addr1 +until the next line whose input line number is a multiple of +.IR N . +.SH "REGULAR EXPRESSIONS" POSIX.2 BREs .I should -be supported, but they aren't completely yet. +be supported, but they aren't completely because of performance +problems. The .B \en -sequence in a regular expression matches the newline character. -There are also some GNU extensions. -[XXX FIXME: more needs to be said. -At the very least, a reference to another document which -describes what is supported should be given.] -.SH -Miscellaneous notes -This version of sed supports a -.RB \e -sequence in -all regular expressions, the -.I replacement -part of a substitute (s) command, and in the -.I source -and -.I dest -parts of a transliterate (y) command. -The \e is stripped, and the newline is kept. -.SH -SEE ALSO +sequence in a regular expression matches the newline character, +and similarly for +.BR \ea , +.BR \et , +and other sequences. +.SH BUGS +.PP +E-mail bug reports to +.BR bug-sed@gnu.org . +Also, please include the output of ``sed --version'' in the body +of your report if at all possible. +.SH AUTHOR +Written by Jay Fenlason, Tom Lord, Ken Pizzini, +and Paolo Bonzini. +GNU sed home page: . +General help using GNU software: . +E-mail bug reports to: . +Be sure to include the word ``sed'' somewhere in the ``Subject:'' field. +.SH COPYRIGHT +Copyright \(co 2012 Free Software Foundation, Inc. +License GPLv3+: GNU GPL version 3 or later . +.br +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. +.SH "SEE ALSO" .BR awk (1), .BR ed (1), -.BR expr (1), -.BR emacs (1), -.BR perl (1), +.BR grep (1), .BR tr (1), -.BR vi (1), -.BR regex (5) -[well, one -.I ought -to be written... XXX], +.BR perlre (1), sed.info, any of various books on \*(sd, .na -the \*(sd FAQ (http://www.wollery.demon.co.uk/sedtut10.txt, -http://www.ptug.org/sed/sedfaq.htm). -.SH -BUGS +the \*(sd FAQ (http://sed.sf.net/grabbag/tutorials/sedfaq.txt), +http://sed.sf.net/grabbag/. .PP -E-mail bug reports to -.BR bug-gnu-utils@gnu.org . -Be sure to include the word ``sed'' somewhere in the ``Subject:'' field. +The full documentation for +.B sed +is maintained as a Texinfo manual. If the +.B info +and +.B sed +programs are properly installed at your site, the command +.IP +.B info sed +.PP +should give you access to the complete manual. diff --git a/manual/GNU_sed/translation_list b/manual/GNU_sed/translation_list index 173150ef..4fb3b08c 100644 --- a/manual/GNU_sed/translation_list +++ b/manual/GNU_sed/translation_list @@ -1 +1 @@ -○:GNU sed:3.02:1998/05/07:sed:1:2001/05/07::nakano@apm.seikei.ac.jp:NAKANO Takeo: +☆:GNU sed:3.02=>4.2.2:2012/12/22:sed:1:2001/05/07::nakano@apm.seikei.ac.jp:NAKANO Takeo: -- 2.11.0