Copyright (C) 2000-2012 |
Manpages SEDSection: User Commands (1)Updated: 1998-05-07 Index Return to Main Contents NAMEsed - a Stream EDitorSYNOPSISsed [-n] [-V] [--quiet] [--silent] [--version] [--help] [-e script] [--expression=script] [-f script-file] [--file=script-file] [script-if-no-other-script] [file...] DESCRIPTIONSed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). While in some ways similar to an editor which permits scripted edits (such as ed), sed works by making only one pass over the input(s), and is consequently more efficient. But it is sed's ability to filter text in a pipeline which particularly distinguishes it from other types of editors.OPTIONSSed may be invoked with the following command-line options:
If no -e,-f,--expression, or --file options are given on the command-line, then the first non-option argument on the command line is taken to be the script to be executed. 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 - refers to the standard input stream. The standard input will processed if no file names are specified. Command SynopsisThis is just a brief synopsis of sed commands to serve as a reminder to those who already know sed; other documentation (such as the texinfo document) must be consulted for fuller descriptions.Zero-address ``commands''
Zero- or One- address commands
Commands which accept address ranges
AddressesSed commands can be given with no addresses, in which case the command will be executed for all input lines; with one address, in which case the command will only be executed for input lines which match that address; or with two addresses, in which case the command will be executed for all input lines which match the inclusive range of lines starting from the first address and continuing to the second address. Three things to note about address ranges: the syntax is addr1,addr2 (i.e., the addresses are separated by a comma); the line which addr1 matched will always be accepted, even if addr2 selects an earlier line; and if addr2 is a regexp, it will not be tested against the line that addr1 matched.After the address (or address-range), and before the command, a ! may be inserted, which specifies that the command shall only be executed if the address (or address-range) does not match. The following address types are supported:
Regular expressionsPOSIX.2 BREs should be supported, but they aren't completely yet. The \n 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.]Miscellaneous notesThis version of sed supports a \<newline> sequence in all regular expressions, the replacement part of a substitute (s) command, and in the source and dest parts of a transliterate (y) command. The \ is stripped, and the newline is kept.SEE ALSOawk(1), ed(1), expr(1), emacs(1), perl(1), tr(1), vi(1), regex(7) [well, one ought to be written... XXX], sed.info, any of various books on sed, the sed FAQ (http://www.wollery.demon.co.uk/sedtut10.txt, http://www.ptug.org/sed/sedfaq.htm).BUGSE-mail bug reports to bug-gnu-utils@gnu.org. Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.
Index
This document was created by man2html, using the manual pages. Time: 08:15:06 GMT, April 20, 2024 |