Blame doc/ed.info

Packit Bot a3ac83
This is ed.info, produced by makeinfo version 4.13+ from ed.texi.
Packit Bot a3ac83
Packit Bot a3ac83
INFO-DIR-SECTION Basics
Packit Bot a3ac83
START-INFO-DIR-ENTRY
Packit Bot a3ac83
* Ed: (ed).                     The GNU line editor
Packit Bot a3ac83
END-INFO-DIR-ENTRY
Packit Bot a3ac83
Packit Bot a3ac83
   Copyright (C) 1993, 1994, 2006-2017 Free Software Foundation, Inc.
Packit Bot a3ac83
Packit Bot a3ac83
   Permission is granted to copy, distribute and/or modify this document
Packit Bot a3ac83
under the terms of the GNU Free Documentation License, Version 1.3 or
Packit Bot a3ac83
any later version published by the Free Software Foundation; with no
Packit Bot a3ac83
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
Packit Bot a3ac83
Packit Bot a3ac83
?
Packit Bot a3ac83
File: ed.info,  Node: Top,  Next: Overview,  Up: (dir)
Packit Bot a3ac83
Packit Bot a3ac83
The GNU ed line editor
Packit Bot a3ac83
**********************
Packit Bot a3ac83
Packit Bot a3ac83
This manual is for GNU ed (version 1.14.2, 22 February 2017).
Packit Bot a3ac83
Packit Bot a3ac83
Packit Bot a3ac83
   GNU ed is a line-oriented text editor. It is used to create, display,
Packit Bot a3ac83
modify and otherwise manipulate text files, both interactively and via
Packit Bot a3ac83
shell scripts. A restricted version of ed, red, can only edit files in
Packit Bot a3ac83
the current directory and cannot execute shell commands. Ed is the
Packit Bot a3ac83
"standard" text editor in the sense that it is the original editor for
Packit Bot a3ac83
Unix, and thus widely available. For most purposes, however, it is
Packit Bot a3ac83
superseded by full-screen editors such as GNU Emacs or GNU Moe.
Packit Bot a3ac83
Packit Bot a3ac83
* Menu:
Packit Bot a3ac83
Packit Bot a3ac83
* Overview::                        Overview of the 'ed' command
Packit Bot a3ac83
* Introduction to line editing::    Getting started with GNU 'ed'
Packit Bot a3ac83
* Invoking ed::                     Command line interface
Packit Bot a3ac83
* Line addressing::                 Specifying lines/ranges in the buffer
Packit Bot a3ac83
* Regular expressions::             Patterns for selecting text
Packit Bot a3ac83
* Commands::                        Commands recognized by GNU 'ed'
Packit Bot a3ac83
* Limitations::                     Intrinsic limits of GNU 'ed'
Packit Bot a3ac83
* Diagnostics::                     GNU 'ed' error handling
Packit Bot a3ac83
* Problems::                        Reporting bugs
Packit Bot a3ac83
* GNU Free Documentation License::  How you can copy and share this manual
Packit Bot a3ac83
Packit Bot a3ac83
Packit Bot a3ac83
   Copyright (C) 1993, 1994, 2006-2017 Free Software Foundation, Inc.
Packit Bot a3ac83
Packit Bot a3ac83
   Permission is granted to copy, distribute and/or modify this document
Packit Bot a3ac83
under the terms of the GNU Free Documentation License, Version 1.3 or
Packit Bot a3ac83
any later version published by the Free Software Foundation; with no
Packit Bot a3ac83
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
Packit Bot a3ac83
Packit Bot a3ac83
?
Packit Bot a3ac83
File: ed.info,  Node: Overview,  Next: Introduction to line editing,  Prev: Top,  Up: Top
Packit Bot a3ac83
Packit Bot a3ac83
1 Overview
Packit Bot a3ac83
**********
Packit Bot a3ac83
Packit Bot a3ac83
'ed' is a line-oriented text editor. It is used to create, display,
Packit Bot a3ac83
modify and otherwise manipulate text files. 'red' is a restricted 'ed':
Packit Bot a3ac83
it can only edit files in the current directory and cannot execute
Packit Bot a3ac83
shell commands.
Packit Bot a3ac83
Packit Bot a3ac83
   If invoked with a FILE argument, then a copy of FILE is read into
Packit Bot a3ac83
the editor's buffer. Changes are made to this copy and not directly to
Packit Bot a3ac83
FILE itself. Upon quitting 'ed', any changes not explicitly saved with
Packit Bot a3ac83
a 'w' command are lost.
Packit Bot a3ac83
Packit Bot a3ac83
   Editing is done in two distinct modes: "command" and "input".  When
Packit Bot a3ac83
first invoked, 'ed' is in command mode. In this mode commands are read
Packit Bot a3ac83
from the standard input and executed to manipulate the contents of the
Packit Bot a3ac83
editor buffer. A typical command might look like:
Packit Bot a3ac83
Packit Bot a3ac83
     ,s/OLD/NEW/g
Packit Bot a3ac83
Packit Bot a3ac83
   which replaces all occurences of the string OLD with NEW.
Packit Bot a3ac83
Packit Bot a3ac83
   When an input command, such as 'a' (append), 'i' (insert) or 'c'
Packit Bot a3ac83
(change), is given, 'ed' enters input mode. This is the primary means
Packit Bot a3ac83
of adding text to a file. In this mode, no commands are available;
Packit Bot a3ac83
instead, the standard input is written directly to the editor buffer. A
Packit Bot a3ac83
"line" consists of the text up to and including a <newline> character.
Packit Bot a3ac83
Input mode is terminated by entering a single period ('.') on a line.
Packit Bot a3ac83
Packit Bot a3ac83
   All 'ed' commands operate on whole lines or ranges of lines; e.g.,
Packit Bot a3ac83
the 'd' command deletes lines; the 'm' command moves lines, and so on.
Packit Bot a3ac83
It is possible to modify only a portion of a line by means of
Packit Bot a3ac83
replacement, as in the example above. However even here, the 's'
Packit Bot a3ac83
command is applied to whole lines at a time.
Packit Bot a3ac83
Packit Bot a3ac83
   In general, 'ed' commands consist of zero or more line addresses,
Packit Bot a3ac83
followed by a single character command and possibly additional
Packit Bot a3ac83
parameters; i.e., commands have the structure:
Packit Bot a3ac83
Packit Bot a3ac83
     [ADDRESS[,ADDRESS]]COMMAND[PARAMETERS]
Packit Bot a3ac83
Packit Bot a3ac83
   The ADDRESSes indicate the line or range of lines to be affected by
Packit Bot a3ac83
the command. If fewer addresses are given than the command accepts,
Packit Bot a3ac83
then default addresses are supplied.
Packit Bot a3ac83
Packit Bot a3ac83
?
Packit Bot a3ac83
File: ed.info,  Node: Introduction to line editing,  Next: Invoking ed,  Prev: Overview,  Up: Top
Packit Bot a3ac83
Packit Bot a3ac83
2 Introduction to line editing
Packit Bot a3ac83
******************************
Packit Bot a3ac83
Packit Bot a3ac83
'ed' was created, along with the Unix operating system, by Ken Thompson
Packit Bot a3ac83
and Dennis Ritchie. It is the refinement of its more complex,
Packit Bot a3ac83
programmable predecessor, 'QED', to which Thompson and Ritchie had
Packit Bot a3ac83
already added pattern matching capabilities (*note Regular
Packit Bot a3ac83
expressions::).
Packit Bot a3ac83
Packit Bot a3ac83
   For the purposes of this tutorial, a working knowledge of the Unix
Packit Bot a3ac83
shell 'sh' and the Unix file system is recommended, since 'ed' is
Packit Bot a3ac83
designed to interact closely with them.  (*Note GNU bash manual:
Packit Bot a3ac83
(bash)Top, for details about bash).
Packit Bot a3ac83
Packit Bot a3ac83
   The principal difference between line editors and display editors is
Packit Bot a3ac83
that display editors provide instant feedback to user commands, whereas
Packit Bot a3ac83
line editors require sometimes lengthy input before any effects are
Packit Bot a3ac83
seen. The advantage of instant feedback, of course, is that if a mistake
Packit Bot a3ac83
is made, it can be corrected immediately, before more damage is done.
Packit Bot a3ac83
Editing in 'ed' requires more strategy and forethought; but if you are
Packit Bot a3ac83
up to the task, it can be quite efficient.
Packit Bot a3ac83
Packit Bot a3ac83
   Much of the 'ed' command syntax is shared with other Unix utilities.
Packit Bot a3ac83
Packit Bot a3ac83
   As with the shell, <RETURN> (the carriage-return key) enters a line
Packit Bot a3ac83
of input. So when we speak of "entering" a command or some text in
Packit Bot a3ac83
'ed', <RETURN> is implied at the end of each line. Prior to typing
Packit Bot a3ac83
<RETURN>, corrections to the line may be made by typing either
Packit Bot a3ac83
<BACKSPACE> to erase characters backwards, or <CONTROL>-u (i.e., hold
Packit Bot a3ac83
the CONTROL key and type u) to erase the whole line.
Packit Bot a3ac83
Packit Bot a3ac83
   When 'ed' first opens, it expects to be told what to do but doesn't
Packit Bot a3ac83
prompt us like the shell. So let's begin by telling 'ed' to do so with
Packit Bot a3ac83
the 

("prompt") command:

Packit Bot a3ac83
Packit Bot a3ac83
     $ ed
Packit Bot a3ac83
     P
Packit Bot a3ac83
     *
Packit Bot a3ac83
Packit Bot a3ac83
   By default, 'ed' uses asterisk ('*') as command prompt to avoid
Packit Bot a3ac83
confusion with the shell command prompt ('$').
Packit Bot a3ac83
Packit Bot a3ac83
   We can run Unix shell ('sh') commands from inside 'ed' by prefixing
Packit Bot a3ac83
them with  (exclamation mark, aka "bang"). For example:
Packit Bot a3ac83
Packit Bot a3ac83
     *!date
Packit Bot a3ac83
     Mon Jun 26 10:08:41 PDT 2006
Packit Bot a3ac83
     !
Packit Bot a3ac83
     *!for s in hello world; do echo $s; done
Packit Bot a3ac83
     hello
Packit Bot a3ac83
     world
Packit Bot a3ac83
     !
Packit Bot a3ac83
     *
Packit Bot a3ac83
Packit Bot a3ac83
   So far, this is no different from running commands in the Unix shell.
Packit Bot a3ac83
But let's say we want to edit the output of a command, or save it to a
Packit Bot a3ac83
file. First we must capture the command output to a temporary location
Packit Bot a3ac83
called a "buffer" where 'ed' can access it. This is done with 'ed''s
Packit Bot a3ac83
<r> command (mnemonic: "read"):
Packit Bot a3ac83
Packit Bot a3ac83
     *r !cal -m
Packit Bot a3ac83
     137
Packit Bot a3ac83
     *
Packit Bot a3ac83
Packit Bot a3ac83
   Here 'ed' is telling us that it has just read 137 characters into
Packit Bot a3ac83
the editor buffer - i.e., the output of the 'cal' command, which prints
Packit Bot a3ac83
a simple ASCII calendar. To display the buffer contents we issue the
Packit Bot a3ac83

("print") command (not to be confused with the prompt command,

Packit Bot a3ac83
which is uppercase!). To indicate the range of lines in the buffer that
Packit Bot a3ac83
should be printed, we prefix the command with <,> (comma) which is
Packit Bot a3ac83
shorthand for "the whole buffer":
Packit Bot a3ac83
Packit Bot a3ac83
     *,p
Packit Bot a3ac83
           June 2006
Packit Bot a3ac83
     Mo Tu We Th Fr Sa Su
Packit Bot a3ac83
               1  2  3  4
Packit Bot a3ac83
      5  6  7  8  9 10 11
Packit Bot a3ac83
     12 13 14 15 16 17 18
Packit Bot a3ac83
     19 20 21 22 23 24 25
Packit Bot a3ac83
     26 27 28 29 30
Packit Bot a3ac83
Packit Bot a3ac83
     *
Packit Bot a3ac83
Packit Bot a3ac83
   Now let's write the buffer contents to a file named 'junk' with the
Packit Bot a3ac83
<w> ("write") command:
Packit Bot a3ac83
Packit Bot a3ac83
     *w junk
Packit Bot a3ac83
     137
Packit Bot a3ac83
     *
Packit Bot a3ac83
Packit Bot a3ac83
   Need we say? It's good practice to frequently write the buffer
Packit Bot a3ac83
contents, since unwritten changes to the buffer will be lost when we
Packit Bot a3ac83
exit 'ed'.
Packit Bot a3ac83
Packit Bot a3ac83
   The sample sessions below illustrate some basic concepts of line
Packit Bot a3ac83
editing with 'ed'. We begin by creating a file, 'sonnet', with some
Packit Bot a3ac83
help from Shakespeare. As with the shell, all input to 'ed' must be
Packit Bot a3ac83
followed by a <newline> character. Commands beginning with '#' are
Packit Bot a3ac83
taken as comments and ignored. Input mode lines that begin with '#' are
Packit Bot a3ac83
just more input.
Packit Bot a3ac83
Packit Bot a3ac83
     $ ed
Packit Bot a3ac83
     # The 'a' command is for appending text to the editor buffer.
Packit Bot a3ac83
     a
Packit Bot a3ac83
     No more be grieved at that which thou hast done.
Packit Bot a3ac83
     Roses have thorns, and filvers foutians mud.
Packit Bot a3ac83
     Clouds and eclipses stain both moon and sun,
Packit Bot a3ac83
     And loathsome canker lives in sweetest bud.
Packit Bot a3ac83
     .
Packit Bot a3ac83
     # Entering a single period on a line returns 'ed' to command mode.
Packit Bot a3ac83
     # Now write the buffer to the file 'sonnet' and quit:
Packit Bot a3ac83
     w sonnet
Packit Bot a3ac83
     183
Packit Bot a3ac83
     # 'ed' reports the number of characters written.
Packit Bot a3ac83
     q
Packit Bot a3ac83
     $ ls -l
Packit Bot a3ac83
     total 2
Packit Bot a3ac83
     -rw-rw-r--    1 alm           183 Nov 10 01:16 sonnet
Packit Bot a3ac83
     $
Packit Bot a3ac83
Packit Bot a3ac83
   In the next example, some typos are corrected in the file 'sonnet'.
Packit Bot a3ac83
Packit Bot a3ac83
     $ ed sonnet
Packit Bot a3ac83
     183
Packit Bot a3ac83
     # Begin by printing the buffer to the terminal with the 'p' command.
Packit Bot a3ac83
     # The ',' means "all lines".
Packit Bot a3ac83
     ,p
Packit Bot a3ac83
     No more be grieved at that which thou hast done.
Packit Bot a3ac83
     Roses have thorns, and filvers foutians mud.
Packit Bot a3ac83
     Clouds and eclipses stain both moon and sun,
Packit Bot a3ac83
     And loathsome canker lives in sweetest bud.
Packit Bot a3ac83
     # Select line 2 for editing.
Packit Bot a3ac83
     2
Packit Bot a3ac83
     Roses have thorns, and filvers foutians mud.
Packit Bot a3ac83
     # Use the substitute command, 's', to replace 'filvers' with 'silver',
Packit Bot a3ac83
     # and print the result.
Packit Bot a3ac83
     s/filvers/silver/p
Packit Bot a3ac83
     Roses have thorns, and silver foutians mud.
Packit Bot a3ac83
     # And correct the spelling of 'fountains'.
Packit Bot a3ac83
     s/utia/untai/p
Packit Bot a3ac83
     Roses have thorns, and silver fountains mud.
Packit Bot a3ac83
     w sonnet
Packit Bot a3ac83
     183
Packit Bot a3ac83
     q
Packit Bot a3ac83
     $
Packit Bot a3ac83
Packit Bot a3ac83
   Since 'ed' is line-oriented, we have to tell it which line, or range
Packit Bot a3ac83
of lines we want to edit. In the above example, we do this by
Packit Bot a3ac83
specifying the line's number, or sequence in the buffer. Alternatively,
Packit Bot a3ac83
we could have specified a unique string in the line, e.g., '/filvers/',
Packit Bot a3ac83
where the '/'s delimit the string in question.  Subsequent commands
Packit Bot a3ac83
affect only the selected line, a.k.a. the "current" line. Portions of
Packit Bot a3ac83
that line are then replaced with the substitute command, whose syntax
Packit Bot a3ac83
is 's/OLD/NEW/'.
Packit Bot a3ac83
Packit Bot a3ac83
   Although 'ed' accepts only one command per line, the print command
Packit Bot a3ac83
'p' is an exception, and may be appended to the end of most commands.
Packit Bot a3ac83
Packit Bot a3ac83
   In the next example, a title is added to our sonnet.
Packit Bot a3ac83
Packit Bot a3ac83
     $ ed sonnet
Packit Bot a3ac83
     183
Packit Bot a3ac83
     a
Packit Bot a3ac83
      Sonnet #50
Packit Bot a3ac83
     .
Packit Bot a3ac83
     ,p
Packit Bot a3ac83
     No more be grieved at that which thou hast done.
Packit Bot a3ac83
     Roses have thorns, and silver fountains mud.
Packit Bot a3ac83
     Clouds and eclipses stain both moon and sun,
Packit Bot a3ac83
     And loathsome canker lives in sweetest bud.
Packit Bot a3ac83
      Sonnet #50
Packit Bot a3ac83
     # The title got appended to the end; we should have used '0a'
Packit Bot a3ac83
     # to append "before the first line".
Packit Bot a3ac83
     # Move the title to its proper place.
Packit Bot a3ac83
     5m0p
Packit Bot a3ac83
      Sonnet #50
Packit Bot a3ac83
     # The title is now the first line, and the current address has been
Packit Bot a3ac83
     # set to the address of this line as well.
Packit Bot a3ac83
     ,p
Packit Bot a3ac83
      Sonnet #50
Packit Bot a3ac83
     No more be grieved at that which thou hast done.
Packit Bot a3ac83
     Roses have thorns, and silver fountains mud.
Packit Bot a3ac83
     Clouds and eclipses stain both moon and sun,
Packit Bot a3ac83
     And loathsome canker lives in sweetest bud.
Packit Bot a3ac83
     wq sonnet
Packit Bot a3ac83
     195
Packit Bot a3ac83
     $
Packit Bot a3ac83
Packit Bot a3ac83
   When 'ed' opens a file, the current address is initially set to the
Packit Bot a3ac83
address of the last line of that file. Similarly, the move command 'm'
Packit Bot a3ac83
sets the current address to the address of the last line moved.
Packit Bot a3ac83
Packit Bot a3ac83
   Related programs or routines are 'vi (1)', 'sed (1)', 'regex (3)',
Packit Bot a3ac83
'sh (1)'. Relevant documents are:
Packit Bot a3ac83
Packit Bot a3ac83
     Unix User's Manual Supplementary Documents: 12 -- 13
Packit Bot a3ac83
Packit Bot a3ac83
     B. W. Kernighan and P. J. Plauger: "Software Tools in Pascal",
Packit Bot a3ac83
     Addison-Wesley, 1981.
Packit Bot a3ac83
Packit Bot a3ac83
?
Packit Bot a3ac83
File: ed.info,  Node: Invoking ed,  Next: Line addressing,  Prev: Introduction to line editing,  Up: Top
Packit Bot a3ac83
Packit Bot a3ac83
3 Invoking ed
Packit Bot a3ac83
*************
Packit Bot a3ac83
Packit Bot a3ac83
The format for running 'ed' is:
Packit Bot a3ac83
Packit Bot a3ac83
     ed [OPTIONS] [FILE]
Packit Bot a3ac83
     red [OPTIONS] [FILE]
Packit Bot a3ac83
Packit Bot a3ac83
   FILE specifies the name of a file to read. If FILE is prefixed with
Packit Bot a3ac83
a bang (!), then it is interpreted as a shell command. In this case,
Packit Bot a3ac83
what is read is the standard output of FILE executed via 'sh (1)'. To
Packit Bot a3ac83
read a file whose name begins with a bang, prefix the name with a
Packit Bot a3ac83
backslash ('\'). The default filename is set to FILE only if it is not
Packit Bot a3ac83
prefixed with a bang.
Packit Bot a3ac83
Packit Bot a3ac83
   'ed' supports the following options:
Packit Bot a3ac83
Packit Bot a3ac83
'-h'
Packit Bot a3ac83
'--help'
Packit Bot a3ac83
     Print an informative help message describing the options and exit.
Packit Bot a3ac83
Packit Bot a3ac83
'-V'
Packit Bot a3ac83
'--version'
Packit Bot a3ac83
     Print the version number of 'ed' on the standard output and exit.
Packit Bot a3ac83
Packit Bot a3ac83
'-G'
Packit Bot a3ac83
'--traditional'
Packit Bot a3ac83
     Forces backwards compatibility. This affects the behavior of the
Packit Bot a3ac83
     'ed' commands 'G', 'V', 'f', 'l', 'm', 't' and '!!'. If the
Packit Bot a3ac83
     default behavior of these commands does not seem familiar, then
Packit Bot a3ac83
     try invoking 'ed' with this switch.
Packit Bot a3ac83
Packit Bot a3ac83
'-l'
Packit Bot a3ac83
'--loose-exit-status'
Packit Bot a3ac83
     Don't exit with bad status if a command happens to "fail" (for
Packit Bot a3ac83
     example if a substitution command finds nothing to replace). This
Packit Bot a3ac83
     can be useful when 'ed' is invoked as the editor for crontab.
Packit Bot a3ac83
Packit Bot a3ac83
'-p STRING'
Packit Bot a3ac83
'--prompt=STRING'
Packit Bot a3ac83
     Specifies a command prompt. This may be toggled on and off with the
Packit Bot a3ac83
     'P' command.
Packit Bot a3ac83
Packit Bot a3ac83
'-r'
Packit Bot a3ac83
'--restricted'
Packit Bot a3ac83
     Run in restricted mode. This mode disables editing of files out of
Packit Bot a3ac83
     the current directory and execution of shell commands.
Packit Bot a3ac83
Packit Bot a3ac83
'-s'
Packit Bot a3ac83
'--quiet'
Packit Bot a3ac83
'--silent'
Packit Bot a3ac83
     Suppresses diagnostics, the printing of byte counts by 'e', 'E',
Packit Bot a3ac83
     'r' and 'w' commands, and the '!' prompt after a '!' command. This
Packit Bot a3ac83
     option may be useful if 'ed''s standard input is from a script.
Packit Bot a3ac83
Packit Bot a3ac83
'-v'
Packit Bot a3ac83
'--verbose'
Packit Bot a3ac83
     Verbose mode; prints error explanations. This may be toggled on
Packit Bot a3ac83
     and off with the 'H' command.
Packit Bot a3ac83
Packit Bot a3ac83
Packit Bot a3ac83
   Exit status: 0 if no errors occurred; otherwise >0.
Packit Bot a3ac83
Packit Bot a3ac83
?
Packit Bot a3ac83
File: ed.info,  Node: Line addressing,  Next: Regular expressions,  Prev: Invoking ed,  Up: Top
Packit Bot a3ac83
Packit Bot a3ac83
4 Line addressing
Packit Bot a3ac83
*****************
Packit Bot a3ac83
Packit Bot a3ac83
An address represents the number of a line in the buffer. 'ed'
Packit Bot a3ac83
maintains a "current address" which is typically supplied to commands
Packit Bot a3ac83
as the default address when none is specified. When a file is first
Packit Bot a3ac83
read, the current address is set to the address of the last line of the
Packit Bot a3ac83
file. In general, the current address is set to the address of the last
Packit Bot a3ac83
line affected by a command.
Packit Bot a3ac83
Packit Bot a3ac83
   One exception to the rule that addresses represent line numbers is
Packit Bot a3ac83
the address '0' (zero). This means "before the first line", and is
Packit Bot a3ac83
valid wherever it makes sense.
Packit Bot a3ac83
Packit Bot a3ac83
   An address range is two addresses separated either by a comma (',')
Packit Bot a3ac83
or a semicolon (';'). In a semicolon-delimited range, the current
Packit Bot a3ac83
address ('.') is set to the first address before the second address is
Packit Bot a3ac83
calculated. This feature can be used to set the starting line for
Packit Bot a3ac83
searches. The value of the first address in a range cannot exceed the
Packit Bot a3ac83
value of the second.
Packit Bot a3ac83
Packit Bot a3ac83
   Addresses can be omitted on either side of the comma or semicolon
Packit Bot a3ac83
separator. If only the first address is given in a range, then the
Packit Bot a3ac83
second address is set to the given address. If only the second address
Packit Bot a3ac83
is given, the resulting address pairs are '1,addr' and '.;addr'
Packit Bot a3ac83
respectively. If a N-tuple of addresses is given where N > 2, then the
Packit Bot a3ac83
corresponding range is determined by the last two addresses in the
Packit Bot a3ac83
N-tuple. If only one address is expected, then the last address is
Packit Bot a3ac83
used. It is an error to give any number of addresses to a command that
Packit Bot a3ac83
requires zero addresses.
Packit Bot a3ac83
Packit Bot a3ac83
   A line address is constructed as follows:
Packit Bot a3ac83
Packit Bot a3ac83
'.'
Packit Bot a3ac83
     The current line (address) in the buffer.
Packit Bot a3ac83
Packit Bot a3ac83
'$'
Packit Bot a3ac83
     The last line in the buffer.
Packit Bot a3ac83
Packit Bot a3ac83
'N'
Packit Bot a3ac83
     The Nth line in the buffer, where N is a number in the range '0,$'.
Packit Bot a3ac83
Packit Bot a3ac83
'+N'
Packit Bot a3ac83
     The Nth next line, where N is a non-negative number.
Packit Bot a3ac83
Packit Bot a3ac83
'-N'
Packit Bot a3ac83
     The Nth previous line, where N is a non-negative number.
Packit Bot a3ac83
Packit Bot a3ac83
'+'
Packit Bot a3ac83
     The next line. This is equivalent to '+1' and may be repeated with
Packit Bot a3ac83
     cumulative effect.
Packit Bot a3ac83
Packit Bot a3ac83
'-'
Packit Bot a3ac83
     The previous line. This is equivalent to '-1' and may be repeated
Packit Bot a3ac83
     with cumulative effect.
Packit Bot a3ac83
Packit Bot a3ac83
','
Packit Bot a3ac83
     The first through last lines in the buffer. This is equivalent to
Packit Bot a3ac83
     the address range '1,$'.
Packit Bot a3ac83
Packit Bot a3ac83
';'
Packit Bot a3ac83
     The current through last lines in the buffer. This is equivalent
Packit Bot a3ac83
     to the address range '.;$'.
Packit Bot a3ac83
Packit Bot a3ac83
'/RE/'
Packit Bot a3ac83
     The next line containing the regular expression RE. The search
Packit Bot a3ac83
     wraps to the beginning of the buffer and continues down to the
Packit Bot a3ac83
     current line, if necessary. A null RE '//' repeats the last search.
Packit Bot a3ac83
Packit Bot a3ac83
'?RE?'
Packit Bot a3ac83
     The previous line containing the regular expression RE. The search
Packit Bot a3ac83
     wraps to the end of the buffer and continues up to the current
Packit Bot a3ac83
     line, if necessary. A null RE '??' repeats the last search.
Packit Bot a3ac83
Packit Bot a3ac83
''x'
Packit Bot a3ac83
     The apostrophe-x character pair addresses the line previously
Packit Bot a3ac83
     marked by a 'k' (mark) command, where 'x' is a lower case letter
Packit Bot a3ac83
     from the portable character set.
Packit Bot a3ac83
Packit Bot a3ac83
Packit Bot a3ac83
   Addresses can be followed by one or more address offsets, optionally
Packit Bot a3ac83
separated by whitespace. Offsets are constructed as follows:
Packit Bot a3ac83
Packit Bot a3ac83
   * '+' or '-' followed by a number adds or subtracts the indicated
Packit Bot a3ac83
     number of lines to or from the address.
Packit Bot a3ac83
Packit Bot a3ac83
   * '+' or '-' not followed by a number adds or subtracts 1 to or from
Packit Bot a3ac83
     the address.
Packit Bot a3ac83
Packit Bot a3ac83
   * A number adds the indicated number of lines to the address.
Packit Bot a3ac83
Packit Bot a3ac83
Packit Bot a3ac83
   It is not an error if an intermediate address value is negative or
Packit Bot a3ac83
greater than the address of the last line in the buffer. It is an error
Packit Bot a3ac83
if the final address value is negative or greater than the address of
Packit Bot a3ac83
the last line in the buffer. It is an error if a search for a RE fails
Packit Bot a3ac83
to find a matching line.
Packit Bot a3ac83
Packit Bot a3ac83
?
Packit Bot a3ac83
File: ed.info,  Node: Regular expressions,  Next: Commands,  Prev: Line addressing,  Up: Top
Packit Bot a3ac83
Packit Bot a3ac83
5 Regular expressions
Packit Bot a3ac83
*********************
Packit Bot a3ac83
Packit Bot a3ac83
Regular expressions are patterns used in selecting text. For example,
Packit Bot a3ac83
the 'ed' command
Packit Bot a3ac83
Packit Bot a3ac83
     g/STRING/
Packit Bot a3ac83
Packit Bot a3ac83
prints all lines containing STRING. Regular expressions are also used
Packit Bot a3ac83
by the 's' command for selecting old text to be replaced with new text.
Packit Bot a3ac83
Packit Bot a3ac83
   In addition to a specifying string literals, regular expressions can
Packit Bot a3ac83
represent classes of strings. Strings thus represented are said to be
Packit Bot a3ac83
matched by the corresponding regular expression. If it is possible for a
Packit Bot a3ac83
regular expression to match several strings in a line, then the
Packit Bot a3ac83
left-most longest match is the one selected.
Packit Bot a3ac83
Packit Bot a3ac83
   The following symbols are used in constructing regular expressions:
Packit Bot a3ac83
Packit Bot a3ac83
'C'
Packit Bot a3ac83
     Any character C not listed below, including '{', '}', '(', ')',
Packit Bot a3ac83
     '<' and '>', matches itself.
Packit Bot a3ac83
Packit Bot a3ac83
'\C'
Packit Bot a3ac83
     Any backslash-escaped character C, other than '{', '}', '(', ')',
Packit Bot a3ac83
     '<', '>', 'b', 'B', 'w', 'W', '+' and '?', matches itself.
Packit Bot a3ac83
Packit Bot a3ac83
'.'
Packit Bot a3ac83
     Matches any single character.
Packit Bot a3ac83
Packit Bot a3ac83
'[CHAR-CLASS]'
Packit Bot a3ac83
     Matches any single character in CHAR-CLASS. To include a ']' in
Packit Bot a3ac83
     CHAR-CLASS, it must be the first character. A range of characters
Packit Bot a3ac83
     may be specified by separating the end characters of the range
Packit Bot a3ac83
     with a '-', e.g., 'a-z' specifies the lower case characters. The
Packit Bot a3ac83
     following literal expressions can also be used in CHAR-CLASS to
Packit Bot a3ac83
     specify sets of characters:
Packit Bot a3ac83
Packit Bot a3ac83
          [:alnum:] [:cntrl:] [:lower:] [:space:]
Packit Bot a3ac83
          [:alpha:] [:digit:] [:print:] [:upper:]
Packit Bot a3ac83
          [:blank:] [:graph:] [:punct:] [:xdigit:]
Packit Bot a3ac83
Packit Bot a3ac83
     If '-' appears as the first or last character of CHAR-CLASS, then
Packit Bot a3ac83
     it matches itself. All other characters in CHAR-CLASS match
Packit Bot a3ac83
     themselves.
Packit Bot a3ac83
Packit Bot a3ac83
     Patterns in CHAR-CLASS of the form:
Packit Bot a3ac83
          [.COL-ELM.]
Packit Bot a3ac83
          [=COL-ELM=]
Packit Bot a3ac83
Packit Bot a3ac83
     where COL-ELM is a "collating element" are interpreted according
Packit Bot a3ac83
     to 'locale (5)'. See 'regex (3)' for an explanation of these
Packit Bot a3ac83
     constructs.
Packit Bot a3ac83
Packit Bot a3ac83
'[^CHAR-CLASS]'
Packit Bot a3ac83
     Matches any single character, other than newline, not in
Packit Bot a3ac83
     CHAR-CLASS.  CHAR-CLASS is defined as above.
Packit Bot a3ac83
Packit Bot a3ac83
'^'
Packit Bot a3ac83
     If '^' is the first character of a regular expression, then it
Packit Bot a3ac83
     anchors the regular expression to the beginning of a line.
Packit Bot a3ac83
     Otherwise, it matches itself.
Packit Bot a3ac83
Packit Bot a3ac83
'$'
Packit Bot a3ac83
     If '$' is the last character of a regular expression, it anchors
Packit Bot a3ac83
     the regular expression to the end of a line. Otherwise, it matches
Packit Bot a3ac83
     itself.
Packit Bot a3ac83
Packit Bot a3ac83
'\(RE\)'
Packit Bot a3ac83
     Defines a (possibly null) subexpression RE. Subexpressions may be
Packit Bot a3ac83
     nested. A subsequent backreference of the form '\N', where N is a
Packit Bot a3ac83
     number in the range [1,9], expands to the text matched by the Nth
Packit Bot a3ac83
     subexpression. For example, the regular expression '\(a.c\)\1'
Packit Bot a3ac83
     matches the string 'abcabc', but not 'abcadc'. Subexpressions are
Packit Bot a3ac83
     ordered relative to their left delimiter.
Packit Bot a3ac83
Packit Bot a3ac83
'*'
Packit Bot a3ac83
     Matches the single character regular expression or subexpression
Packit Bot a3ac83
     immediately preceding it zero or more times. If '*' is the first
Packit Bot a3ac83
     character of a regular expression or subexpression, then it matches
Packit Bot a3ac83
     itself. The '*' operator sometimes yields unexpected results. For
Packit Bot a3ac83
     example, the regular expression 'b*' matches the beginning of the
Packit Bot a3ac83
     string 'abbb', as opposed to the substring 'bbb', since a null
Packit Bot a3ac83
     match is the only left-most match.
Packit Bot a3ac83
Packit Bot a3ac83
'\{N,M\}'
Packit Bot a3ac83
'\{N,\}'
Packit Bot a3ac83
'\{N\}'
Packit Bot a3ac83
     Matches the single character regular expression or subexpression
Packit Bot a3ac83
     immediately preceding it at least N and at most M times. If M is
Packit Bot a3ac83
     omitted, then it matches at least N times. If the comma is also
Packit Bot a3ac83
     omitted, then it matches exactly N times. If any of these forms
Packit Bot a3ac83
     occurs first in a regular expression or subexpression, then it is
Packit Bot a3ac83
     interpreted literally (i.e., the regular expression '\{2\}'
Packit Bot a3ac83
     matches the string '{2}', and so on).
Packit Bot a3ac83
Packit Bot a3ac83
'\<'
Packit Bot a3ac83
'\>'
Packit Bot a3ac83
     Anchors the single character regular expression or subexpression
Packit Bot a3ac83
     immediately following it to the beginning (in the case of '\<') or
Packit Bot a3ac83
     ending (in the case of '\>') of a "word", i.e., in ASCII, a
Packit Bot a3ac83
     maximal string of alphanumeric characters, including the
Packit Bot a3ac83
     underscore (_).
Packit Bot a3ac83
Packit Bot a3ac83
Packit Bot a3ac83
   The following extended operators are preceded by a backslash '\' to
Packit Bot a3ac83
distinguish them from traditional 'ed' syntax.
Packit Bot a3ac83
Packit Bot a3ac83
'\`'
Packit Bot a3ac83
'\''
Packit Bot a3ac83
     Unconditionally matches the beginning '\`' or ending '\'' of a
Packit Bot a3ac83
     line.
Packit Bot a3ac83
Packit Bot a3ac83
'\?'
Packit Bot a3ac83
     Optionally matches the single character regular expression or
Packit Bot a3ac83
     subexpression immediately preceding it. For example, the regular
Packit Bot a3ac83
     expression 'a[bd]\?c' matches the strings 'abc', 'adc' and 'ac'.
Packit Bot a3ac83
     If '\?' occurs at the beginning of a regular expressions or
Packit Bot a3ac83
     subexpression, then it matches a literal '?'.
Packit Bot a3ac83
Packit Bot a3ac83
'\+'
Packit Bot a3ac83
     Matches the single character regular expression or subexpression
Packit Bot a3ac83
     immediately preceding it one or more times. So the regular
Packit Bot a3ac83
     expression 'a+' is shorthand for 'aa*'. If '\+' occurs at the
Packit Bot a3ac83
     beginning of a regular expression or subexpression, then it
Packit Bot a3ac83
     matches a literal '+'.
Packit Bot a3ac83
Packit Bot a3ac83
'\b'
Packit Bot a3ac83
     Matches the beginning or ending (null string) of a word. Thus the
Packit Bot a3ac83
     regular expression '\bhello\b' is equivalent to '\<hello\>'.
Packit Bot a3ac83
     However, '\b\b' is a valid regular expression whereas '\<\>' is
Packit Bot a3ac83
     not.
Packit Bot a3ac83
Packit Bot a3ac83
'\B'
Packit Bot a3ac83
     Matches (a null string) inside a word.
Packit Bot a3ac83
Packit Bot a3ac83
'\w'
Packit Bot a3ac83
     Matches any character in a word.
Packit Bot a3ac83
Packit Bot a3ac83
'\W'
Packit Bot a3ac83
     Matches any character not in a word.
Packit Bot a3ac83
Packit Bot a3ac83
Packit Bot a3ac83
?
Packit Bot a3ac83
File: ed.info,  Node: Commands,  Next: Limitations,  Prev: Regular expressions,  Up: Top
Packit Bot a3ac83
Packit Bot a3ac83
6 Commands
Packit Bot a3ac83
**********
Packit Bot a3ac83
Packit Bot a3ac83
All 'ed' commands are single characters, though some require additonal
Packit Bot a3ac83
parameters. If a command's parameters extend over several lines, then
Packit Bot a3ac83
each line except for the last must be terminated with a backslash ('\').
Packit Bot a3ac83
Packit Bot a3ac83
   In general, at most one command is allowed per line. However, most
Packit Bot a3ac83
commands accept a print suffix, which is any of 'p' (print), 'l'
Packit Bot a3ac83
(list), or 'n' (enumerate), to print the last line affected by the
Packit Bot a3ac83
command. It is not portable to give more than one print suffix, but
Packit Bot a3ac83
'ed' allows any combination of non-repeated print suffixes and combines
Packit Bot a3ac83
their effects.
Packit Bot a3ac83
Packit Bot a3ac83
   An interrupt (typically <Control-C>) has the effect of aborting the
Packit Bot a3ac83
current command and returning the editor to command mode.
Packit Bot a3ac83
Packit Bot a3ac83
   'ed' recognizes the following commands. The commands are shown
Packit Bot a3ac83
together with the default address or address range supplied if none is
Packit Bot a3ac83
specified (in parenthesis).
Packit Bot a3ac83
Packit Bot a3ac83
'(.)a'
Packit Bot a3ac83
     Appends text to the buffer after the addressed line. The address
Packit Bot a3ac83
     '0' (zero) is valid for this command; it places the entered text at
Packit Bot a3ac83
     the beginning of the buffer. Text is entered in input mode. The
Packit Bot a3ac83
     current address is set to the address of the last line entered or,
Packit Bot a3ac83
     if there were none, to the addressed line.
Packit Bot a3ac83
Packit Bot a3ac83
'(.,.)c'
Packit Bot a3ac83
     Changes lines in the buffer. The addressed lines are deleted from
Packit Bot a3ac83
     the buffer, and text is inserted in their place. Text is entered
Packit Bot a3ac83
     in input mode. The current address is set to the address of the
Packit Bot a3ac83
     last line entered or, if there were none, to the new address of
Packit Bot a3ac83
     the line after the last line deleted; if the lines deleted were
Packit Bot a3ac83
     originally at the end of the buffer, the current address is set to
Packit Bot a3ac83
     the address of the new last line; if no lines remain in the
Packit Bot a3ac83
     buffer, the current address is set to zero.
Packit Bot a3ac83
Packit Bot a3ac83
'(.,.)d'
Packit Bot a3ac83
     Deletes the addressed lines from the buffer. The current address
Packit Bot a3ac83
     is set to the new address of the line after the last line deleted;
Packit Bot a3ac83
     if the lines deleted were originally at the end of the buffer, the
Packit Bot a3ac83
     current address is set to the address of the new last line; if no
Packit Bot a3ac83
     lines remain in the buffer, the current address is set to zero.
Packit Bot a3ac83
Packit Bot a3ac83
'e FILE'
Packit Bot a3ac83
     Edits FILE, and sets the default filename. If FILE is not
Packit Bot a3ac83
     specified, then the default filename is used. Any lines in the
Packit Bot a3ac83
     buffer are deleted before the new file is read. The current
Packit Bot a3ac83
     address is set to the address of the last line in the buffer.
Packit Bot a3ac83
Packit Bot a3ac83
     If FILE is prefixed with a bang (!), then it is interpreted as a
Packit Bot a3ac83
     shell command whose output is to be read, (*note shell escape
Packit Bot a3ac83
     command:: '!' below). In this case the default filename is
Packit Bot a3ac83
     unchanged.
Packit Bot a3ac83
Packit Bot a3ac83
     A warning is printed if any changes have been made in the buffer
Packit Bot a3ac83
     since the last 'w' command that wrote the entire buffer to a file.
Packit Bot a3ac83
Packit Bot a3ac83
'E FILE'
Packit Bot a3ac83
     Edits FILE unconditionally. This is similar to the 'e' command,
Packit Bot a3ac83
     except that unwritten changes are discarded without warning.
Packit Bot a3ac83
Packit Bot a3ac83
'f FILE'
Packit Bot a3ac83
     Sets the default filename to FILE. If FILE is not specified, then
Packit Bot a3ac83
     the default unescaped filename is printed.
Packit Bot a3ac83
Packit Bot a3ac83
'(1,$)g/RE/COMMAND-LIST'
Packit Bot a3ac83
     Global command. The global command makes two passes over the file.
Packit Bot a3ac83
     On the first pass, all the addressed lines matching a regular
Packit Bot a3ac83
     expression RE are marked. Then, going sequentially from the
Packit Bot a3ac83
     beginning of the file to the end of the file, the given
Packit Bot a3ac83
     COMMAND-LIST is executed for each marked line, with the current
Packit Bot a3ac83
     address set to the address of that line. Any line modified by the
Packit Bot a3ac83
     COMMAND-LIST is unmarked. The final value of the current address
Packit Bot a3ac83
     is the value assigned by the last command in the last COMMAND-LIST
Packit Bot a3ac83
     executed. If there were no matching lines, the current address is
Packit Bot a3ac83
     unchanged.
Packit Bot a3ac83
Packit Bot a3ac83
     The first command of COMMAND-LIST must appear on the same line as
Packit Bot a3ac83
     the 'g' command. All lines of a multi-line COMMAND-LIST except the
Packit Bot a3ac83
     last line must be terminated with a backslash ('\'). Any commands
Packit Bot a3ac83
     are allowed, except for 'g', 'G', 'v', and 'V'. The '.'
Packit Bot a3ac83
     terminating the input mode of commands 'a', 'c', and 'i' can be
Packit Bot a3ac83
     omitted if it would be the last line of COMMAND-LIST. By default,
Packit Bot a3ac83
     a newline alone in COMMAND-LIST is equivalent to a 'p' command. If
Packit Bot a3ac83
     'ed' is invoked with the command-line option '-G', then a newline
Packit Bot a3ac83
     in COMMAND-LIST is equivalent to a '.+1p' command.
Packit Bot a3ac83
Packit Bot a3ac83
'(1,$)G/RE/'
Packit Bot a3ac83
     Interactive global command. Interactively edits the addressed lines
Packit Bot a3ac83
     matching a regular expression RE. For each matching line, the line
Packit Bot a3ac83
     is printed, the current address is set, and the user is prompted to
Packit Bot a3ac83
     enter a COMMAND-LIST. The final value of the current address is
Packit Bot a3ac83
     the value assigned by the last command executed. If there were no
Packit Bot a3ac83
     matching lines, the current address is unchanged.
Packit Bot a3ac83
Packit Bot a3ac83
     The format of COMMAND-LIST is the same as that of the 'g' command.
Packit Bot a3ac83
     A newline alone acts as a null command list. A single '&' repeats
Packit Bot a3ac83
     the last non-null command list.
Packit Bot a3ac83
Packit Bot a3ac83
'h'
Packit Bot a3ac83
     Prints an explanation of the last error.
Packit Bot a3ac83
Packit Bot a3ac83
'H'
Packit Bot a3ac83
     Toggles the printing of error explanations. By default,
Packit Bot a3ac83
     explanations are not printed. It is recommended that ed scripts
Packit Bot a3ac83
     begin with this command to aid in debugging.
Packit Bot a3ac83
Packit Bot a3ac83
'(.)i'
Packit Bot a3ac83
     Inserts text in the buffer before the addressed line. The address
Packit Bot a3ac83
     '0' (zero) is valid for this command; it is equivalent to address
Packit Bot a3ac83
     '1'. Text is entered in input mode. The current address is set to
Packit Bot a3ac83
     the address of the last line entered or, if there were none, to the
Packit Bot a3ac83
     addressed line.
Packit Bot a3ac83
Packit Bot a3ac83
'(.,.+1)j'
Packit Bot a3ac83
     Joins the addressed lines, replacing them by a single line
Packit Bot a3ac83
     containing their joined text. If only one address is given, this
Packit Bot a3ac83
     command does nothing. If lines are joined, the current address is
Packit Bot a3ac83
     set to the address of the joined line. Else, the current address
Packit Bot a3ac83
     is unchanged.
Packit Bot a3ac83
Packit Bot a3ac83
'(.)kx'
Packit Bot a3ac83
     Marks a line with a lower case letter 'x'. The line can then be
Packit Bot a3ac83
     addressed as ''x' (i.e., a single quote followed by 'x') in
Packit Bot a3ac83
     subsequent commands. The mark is not cleared until the line is
Packit Bot a3ac83
     deleted or otherwise modified. The current address is unchanged.
Packit Bot a3ac83
Packit Bot a3ac83
'(.,.)l'
Packit Bot a3ac83
     List command. Prints the addressed lines unambiguously. The end of
Packit Bot a3ac83
     each line is marked with a '$', and every '$' character within the
Packit Bot a3ac83
     text is printed with a preceding backslash. Special characters are
Packit Bot a3ac83
     printed as escape sequences. The current address is set to the
Packit Bot a3ac83
     address of the last line printed.
Packit Bot a3ac83
Packit Bot a3ac83
'(.,.)m(.)'
Packit Bot a3ac83
     Moves lines in the buffer. The addressed lines are moved to after
Packit Bot a3ac83
     the right-hand destination address. The destination address '0'
Packit Bot a3ac83
     (zero) is valid for this command; it moves the addressed lines to
Packit Bot a3ac83
     the beginning of the buffer. It is an error if the destination
Packit Bot a3ac83
     address falls within the range of moved lines. The current address
Packit Bot a3ac83
     is set to the new address of the last line moved.
Packit Bot a3ac83
Packit Bot a3ac83
'(.,.)n'
Packit Bot a3ac83
     Number command. Prints the addressed lines, preceding each line by
Packit Bot a3ac83
     its line number and a <tab>. The current address is set to the
Packit Bot a3ac83
     address of the last line printed.
Packit Bot a3ac83
Packit Bot a3ac83
'(.,.)p'
Packit Bot a3ac83
     Prints the addressed lines. The current address is set to the
Packit Bot a3ac83
     address of the last line printed.
Packit Bot a3ac83
Packit Bot a3ac83
'P'
Packit Bot a3ac83
     Toggles the command prompt on and off. Unless a prompt is
Packit Bot a3ac83
     specified with command-line option '-p', the command prompt is by
Packit Bot a3ac83
     default turned off.
Packit Bot a3ac83
Packit Bot a3ac83
'q'
Packit Bot a3ac83
     Quits 'ed'. A warning is printed if any changes have been made in
Packit Bot a3ac83
     the buffer since the last 'w' command that wrote the entire buffer
Packit Bot a3ac83
     to a file.
Packit Bot a3ac83
Packit Bot a3ac83
'Q'
Packit Bot a3ac83
     Quits 'ed' unconditionally. This is similar to the 'q' command,
Packit Bot a3ac83
     except that unwritten changes are discarded without warning.
Packit Bot a3ac83
Packit Bot a3ac83
'($)r FILE'
Packit Bot a3ac83
     Reads FILE and appends it after the addressed line. If FILE is not
Packit Bot a3ac83
     specified, then the default filename is used. If there is no
Packit Bot a3ac83
     default filename prior to the command, then the default filename
Packit Bot a3ac83
     is set to FILE. Otherwise, the default filename is unchanged. The
Packit Bot a3ac83
     address '0' (zero) is valid for this command; it reads the file at
Packit Bot a3ac83
     the beginning of the buffer. The current address is set to the
Packit Bot a3ac83
     address of the last line read or, if there were none, to the
Packit Bot a3ac83
     addressed line.
Packit Bot a3ac83
Packit Bot a3ac83
     If FILE is prefixed with a bang (!), then it is interpreted as a
Packit Bot a3ac83
     shell command whose output is to be read, (*note shell escape
Packit Bot a3ac83
     command:: '!' below). In this case the default filename is
Packit Bot a3ac83
     unchanged.
Packit Bot a3ac83
Packit Bot a3ac83
'(.,.)s/RE/REPLACEMENT/'
Packit Bot a3ac83
     Substitute command. Replaces text in the addressed lines matching a
Packit Bot a3ac83
     regular expression RE with REPLACEMENT. By default, only the first
Packit Bot a3ac83
     match in each line is replaced. The 's' command accepts any
Packit Bot a3ac83
     combination of the suffixes 'g', 'COUNT', 'l', 'n', and 'p'. If
Packit Bot a3ac83
     the 'g' (global) suffix is given, then every match is replaced.
Packit Bot a3ac83
     The 'COUNT' suffix, where COUNT is a positive number, causes only
Packit Bot a3ac83
     the COUNTth match to be replaced. 'g' and 'COUNT' can't be
Packit Bot a3ac83
     specified in the same command. 'l', 'n', and 'p' are the usual
Packit Bot a3ac83
     print suffixes. It is an error if no substitutions are performed
Packit Bot a3ac83
     on any of the addressed lines. The current address is set to the
Packit Bot a3ac83
     address of the last line on which a substitution occurred. If a
Packit Bot a3ac83
     line is split, a substitution is considered to have occurred on
Packit Bot a3ac83
     each of the new lines. If no substitution is performed, the
Packit Bot a3ac83
     current address is unchanged.
Packit Bot a3ac83
Packit Bot a3ac83
     RE and REPLACEMENT may be delimited by any character other than
Packit Bot a3ac83
     <space>, <newline> and the characters used by the form of the 's'
Packit Bot a3ac83
     command shown below. If the last delimiter is omitted, then the
Packit Bot a3ac83
     last line affected is printed as if the print suffix 'p' were
Packit Bot a3ac83
     specified. The last delimiter can't be omitted if the 's' command
Packit Bot a3ac83
     is part of a 'g' or 'v' COMMAND-LIST and is not the last command
Packit Bot a3ac83
     in the list, because the meaning of the following escaped newline
Packit Bot a3ac83
     becomes ambiguous.
Packit Bot a3ac83
Packit Bot a3ac83
     An unescaped '&' in REPLACEMENT is replaced by the currently
Packit Bot a3ac83
     matched text. The character sequence '\M' where M is a number in
Packit Bot a3ac83
     the range [1,9], is replaced by the Mth backreference expression
Packit Bot a3ac83
     of the matched text. If the corresponding backreference expression
Packit Bot a3ac83
     does not match, then the character sequence '\M' is replaced by
Packit Bot a3ac83
     the empty string. If REPLACEMENT consists of a single '%', then
Packit Bot a3ac83
     REPLACEMENT from the last substitution is used.
Packit Bot a3ac83
Packit Bot a3ac83
     A line can be split by including a newline escaped with a backslash
Packit Bot a3ac83
     ('\') in REPLACEMENT, except if the 's' command is part of a 'g'
Packit Bot a3ac83
     or 'v' COMMAND-LIST, because in this case the meaning of the
Packit Bot a3ac83
     escaped newline becomes ambiguous. Each backslash in REPLACEMENT
Packit Bot a3ac83
     removes the special meaning (if any) of the following character.
Packit Bot a3ac83
Packit Bot a3ac83
'(.,.)s'
Packit Bot a3ac83
     Repeats the last substitution. This form of the 's' command accepts
Packit Bot a3ac83
     the 'g' and 'COUNT' suffixes described above, and any combination
Packit Bot a3ac83
     of the suffixes 'p' and 'r'. The 'g' suffix toggles the global
Packit Bot a3ac83
     suffix of the last substitution and resets COUNT to 1. The 'p'
Packit Bot a3ac83
     suffix toggles the print suffixes of the last substitution. The
Packit Bot a3ac83
     'r' suffix causes the regular expression of the last search to be
Packit Bot a3ac83
     used instead of that of the last substitution (if the search
Packit Bot a3ac83
     happened after the substitution).
Packit Bot a3ac83
Packit Bot a3ac83
'(.,.)t(.)'
Packit Bot a3ac83
     Copies (i.e., transfers) the addressed lines to after the
Packit Bot a3ac83
     right-hand destination address. If the destination address is '0'
Packit Bot a3ac83
     (zero), the lines are copied at the beginning of the buffer. The
Packit Bot a3ac83
     current address is set to the address of the last line copied.
Packit Bot a3ac83
Packit Bot a3ac83
'u'
Packit Bot a3ac83
     Undoes the effect of the last command that modified anything in the
Packit Bot a3ac83
     buffer and restores the current address to what it was before the
Packit Bot a3ac83
     command. The global commands 'g', 'G', 'v', and 'V' are treated as
Packit Bot a3ac83
     a single command by undo. 'u' is its own inverse.
Packit Bot a3ac83
Packit Bot a3ac83
'(1,$)v/RE/COMMAND-LIST'
Packit Bot a3ac83
     This is similar to the 'g' command except that it applies
Packit Bot a3ac83
     COMMAND-LIST to each of the addressed lines not matching the
Packit Bot a3ac83
     regular expression RE.
Packit Bot a3ac83
Packit Bot a3ac83
'(1,$)V/RE/'
Packit Bot a3ac83
     This is similar to the 'G' command except that it interactively
Packit Bot a3ac83
     edits the addressed lines not matching the regular expression RE.
Packit Bot a3ac83
Packit Bot a3ac83
'(1,$)w FILE'
Packit Bot a3ac83
     Writes the addressed lines to FILE. Any previous contents of FILE
Packit Bot a3ac83
     is lost without warning. If there is no default filename, then the
Packit Bot a3ac83
     default filename is set to FILE, otherwise it is unchanged. If no
Packit Bot a3ac83
     filename is specified, then the default filename is used. The
Packit Bot a3ac83
     current address is unchanged.
Packit Bot a3ac83
Packit Bot a3ac83
     If FILE is prefixed with a bang (!), then it is interpreted as a
Packit Bot a3ac83
     shell command and the addressed lines are written to its standard
Packit Bot a3ac83
     input, (*note shell escape command:: '!' below). In this case the
Packit Bot a3ac83
     default filename is unchanged. Writing the buffer to a shell
Packit Bot a3ac83
     command does not prevent the warning to the user if an attempt is
Packit Bot a3ac83
     made to overwrite or discard the buffer via the 'e' or 'q'
Packit Bot a3ac83
     commands.
Packit Bot a3ac83
Packit Bot a3ac83
'(1,$)wq FILE'
Packit Bot a3ac83
     Writes the addressed lines to FILE, and then executes a 'q'
Packit Bot a3ac83
     command.
Packit Bot a3ac83
Packit Bot a3ac83
'(1,$)W FILE'
Packit Bot a3ac83
     Appends the addressed lines to the end of FILE. This is similar to
Packit Bot a3ac83
     the 'w' command, except that the previous contents of file is not
Packit Bot a3ac83
     clobbered. The current address is unchanged.
Packit Bot a3ac83
Packit Bot a3ac83
'(.)x'
Packit Bot a3ac83
     Copies (puts) the contents of the cut buffer to after the addressed
Packit Bot a3ac83
     line. The current address is set to the address of the last line
Packit Bot a3ac83
     copied.
Packit Bot a3ac83
Packit Bot a3ac83
'(.,.)y'
Packit Bot a3ac83
     Copies (yanks) the addressed lines to the cut buffer. The cut
Packit Bot a3ac83
     buffer is overwritten by subsequent 'c', 'd', 'j', 's', or 'y'
Packit Bot a3ac83
     commands. The current address is unchanged.
Packit Bot a3ac83
Packit Bot a3ac83
'(.+1)zN'
Packit Bot a3ac83
     Scrolls N lines at a time starting at addressed line, and sets
Packit Bot a3ac83
     window size to N. If N is not specified, then the current window
Packit Bot a3ac83
     size is used. Window size defaults to screen size minus two lines,
Packit Bot a3ac83
     or to 22 if screen size can't be determined. The current address
Packit Bot a3ac83
     is set to the address of the last line printed.
Packit Bot a3ac83
Packit Bot a3ac83
'!COMMAND'
Packit Bot a3ac83
     Shell escape command. Executes COMMAND via 'sh (1)'. If the first
Packit Bot a3ac83
     character of COMMAND is '!', then it is replaced by the text of
Packit Bot a3ac83
     the previous '!COMMAND'. Thus, '!!' repeats the previous
Packit Bot a3ac83
     '!COMMAND'. 'ed' does not process COMMAND for backslash ('\')
Packit Bot a3ac83
     escapes. However, an unescaped '%' is replaced by the default
Packit Bot a3ac83
     filename. When the shell returns from execution, a '!' is printed
Packit Bot a3ac83
     to the standard output. The current address is unchanged.
Packit Bot a3ac83
Packit Bot a3ac83
'(.,.)#'
Packit Bot a3ac83
     Begins a comment; the rest of the line, up to a newline, is
Packit Bot a3ac83
     ignored. If a line address followed by a semicolon is given, then
Packit Bot a3ac83
     the current address is set to that address. Otherwise, the current
Packit Bot a3ac83
     address is unchanged.
Packit Bot a3ac83
Packit Bot a3ac83
'($)='
Packit Bot a3ac83
     Prints the line number of the addressed line. The current address
Packit Bot a3ac83
     is unchanged.
Packit Bot a3ac83
Packit Bot a3ac83
'(.+1)<newline>'
Packit Bot a3ac83
     Null command. An address alone prints the addressed line. A
Packit Bot a3ac83
     <newline> alone is equivalent to '+1p'. The current address is set
Packit Bot a3ac83
     to the address of the printed line.
Packit Bot a3ac83
Packit Bot a3ac83
Packit Bot a3ac83
?
Packit Bot a3ac83
File: ed.info,  Node: Limitations,  Next: Diagnostics,  Prev: Commands,  Up: Top
Packit Bot a3ac83
Packit Bot a3ac83
7 Limitations
Packit Bot a3ac83
*************
Packit Bot a3ac83
Packit Bot a3ac83
If the terminal hangs up, 'ed' attempts to write the buffer to the file
Packit Bot a3ac83
'ed.hup' or, if this fails, to '$HOME/ed.hup'.
Packit Bot a3ac83
Packit Bot a3ac83
   'ed' processes FILE arguments for backslash escapes, i.e., in a
Packit Bot a3ac83
filename, any character preceded by a backslash ('\') is interpreted
Packit Bot a3ac83
literally.
Packit Bot a3ac83
Packit Bot a3ac83
   If a text (non-binary) file is not terminated by a newline character,
Packit Bot a3ac83
then 'ed' appends one on reading/writing it. In the case of a binary
Packit Bot a3ac83
file, 'ed' does not append a newline on reading/writing.
Packit Bot a3ac83
Packit Bot a3ac83
   Per line overhead: 2 'pointer's, 1 'long int', and 1 'int'.
Packit Bot a3ac83
Packit Bot a3ac83
?
Packit Bot a3ac83
File: ed.info,  Node: Diagnostics,  Next: Problems,  Prev: Limitations,  Up: Top
Packit Bot a3ac83
Packit Bot a3ac83
8 Diagnostics
Packit Bot a3ac83
*************
Packit Bot a3ac83
Packit Bot a3ac83
When an error occurs, if 'ed''s input is from a regular file or here
Packit Bot a3ac83
document, then it exits, otherwise it prints a '?' and returns to
Packit Bot a3ac83
command mode. An explanation of the last error can be printed with the
Packit Bot a3ac83
'h' (help) command.
Packit Bot a3ac83
Packit Bot a3ac83
   If the 'u' (undo) command occurs in a global command list, then the
Packit Bot a3ac83
command list is executed only once.
Packit Bot a3ac83
Packit Bot a3ac83
   Attempting to quit 'ed' or edit another file before writing a
Packit Bot a3ac83
modified buffer results in an error. If the command is entered a second
Packit Bot a3ac83
time, it succeeds, but any changes to the buffer are lost.
Packit Bot a3ac83
Packit Bot a3ac83
?
Packit Bot a3ac83
File: ed.info,  Node: Problems,  Next: GNU Free Documentation License,  Prev: Diagnostics,  Up: Top
Packit Bot a3ac83
Packit Bot a3ac83
9 Reporting bugs
Packit Bot a3ac83
****************
Packit Bot a3ac83
Packit Bot a3ac83
There are probably bugs in 'ed'. There are certainly errors and
Packit Bot a3ac83
omissions in this manual. If you report them, they will get fixed. If
Packit Bot a3ac83
you don't, no one will ever know about them and they will remain unfixed
Packit Bot a3ac83
for all eternity, if not longer.
Packit Bot a3ac83
Packit Bot a3ac83
   If you find a bug in 'ed', please send electronic mail to
Packit Bot a3ac83
<bug-ed@gnu.org>. Include the version number, which you can find by
Packit Bot a3ac83
running 'ed --version'.
Packit Bot a3ac83
Packit Bot a3ac83
?
Packit Bot a3ac83
File: ed.info,  Node: GNU Free Documentation License,  Prev: Problems,  Up: Top
Packit Bot a3ac83
Packit Bot a3ac83
10 GNU Free Documentation License
Packit Bot a3ac83
*********************************
Packit Bot a3ac83
Packit Bot a3ac83
                     Version 1.3, 3 November 2008
Packit Bot a3ac83
Packit Bot a3ac83
     Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
Packit Bot a3ac83
     'http://fsf.org/'
Packit Bot a3ac83
Packit Bot a3ac83
     Everyone is permitted to copy and distribute verbatim copies
Packit Bot a3ac83
     of this license document, but changing it is not allowed.
Packit Bot a3ac83
Packit Bot a3ac83
  0. PREAMBLE
Packit Bot a3ac83
Packit Bot a3ac83
     The purpose of this License is to make a manual, textbook, or other
Packit Bot a3ac83
     functional and useful document "free" in the sense of freedom: to
Packit Bot a3ac83
     assure everyone the effective freedom to copy and redistribute it,
Packit Bot a3ac83
     with or without modifying it, either commercially or
Packit Bot a3ac83
     noncommercially.  Secondarily, this License preserves for the
Packit Bot a3ac83
     author and publisher a way to get credit for their work, while not
Packit Bot a3ac83
     being considered responsible for modifications made by others.
Packit Bot a3ac83
Packit Bot a3ac83
     This License is a kind of "copyleft", which means that derivative
Packit Bot a3ac83
     works of the document must themselves be free in the same sense.
Packit Bot a3ac83
     It complements the GNU General Public License, which is a copyleft
Packit Bot a3ac83
     license designed for free software.
Packit Bot a3ac83
Packit Bot a3ac83
     We have designed this License in order to use it for manuals for
Packit Bot a3ac83
     free software, because free software needs free documentation: a
Packit Bot a3ac83
     free program should come with manuals providing the same freedoms
Packit Bot a3ac83
     that the software does.  But this License is not limited to
Packit Bot a3ac83
     software manuals; it can be used for any textual work, regardless
Packit Bot a3ac83
     of subject matter or whether it is published as a printed book.
Packit Bot a3ac83
     We recommend this License principally for works whose purpose is
Packit Bot a3ac83
     instruction or reference.
Packit Bot a3ac83
Packit Bot a3ac83
  1. APPLICABILITY AND DEFINITIONS
Packit Bot a3ac83
Packit Bot a3ac83
     This License applies to any manual or other work, in any medium,
Packit Bot a3ac83
     that contains a notice placed by the copyright holder saying it
Packit Bot a3ac83
     can be distributed under the terms of this License.  Such a notice
Packit Bot a3ac83
     grants a world-wide, royalty-free license, unlimited in duration,
Packit Bot a3ac83
     to use that work under the conditions stated herein.  The
Packit Bot a3ac83
     "Document", below, refers to any such manual or work.  Any member
Packit Bot a3ac83
     of the public is a licensee, and is addressed as "you".  You
Packit Bot a3ac83
     accept the license if you copy, modify or distribute the work in a
Packit Bot a3ac83
     way requiring permission under copyright law.
Packit Bot a3ac83
Packit Bot a3ac83
     A "Modified Version" of the Document means any work containing the
Packit Bot a3ac83
     Document or a portion of it, either copied verbatim, or with
Packit Bot a3ac83
     modifications and/or translated into another language.
Packit Bot a3ac83
Packit Bot a3ac83
     A "Secondary Section" is a named appendix or a front-matter section
Packit Bot a3ac83
     of the Document that deals exclusively with the relationship of the
Packit Bot a3ac83
     publishers or authors of the Document to the Document's overall
Packit Bot a3ac83
     subject (or to related matters) and contains nothing that could
Packit Bot a3ac83
     fall directly within that overall subject.  (Thus, if the Document
Packit Bot a3ac83
     is in part a textbook of mathematics, a Secondary Section may not
Packit Bot a3ac83
     explain any mathematics.)  The relationship could be a matter of
Packit Bot a3ac83
     historical connection with the subject or with related matters, or
Packit Bot a3ac83
     of legal, commercial, philosophical, ethical or political position
Packit Bot a3ac83
     regarding them.
Packit Bot a3ac83
Packit Bot a3ac83
     The "Invariant Sections" are certain Secondary Sections whose
Packit Bot a3ac83
     titles are designated, as being those of Invariant Sections, in
Packit Bot a3ac83
     the notice that says that the Document is released under this
Packit Bot a3ac83
     License.  If a section does not fit the above definition of
Packit Bot a3ac83
     Secondary then it is not allowed to be designated as Invariant.
Packit Bot a3ac83
     The Document may contain zero Invariant Sections.  If the Document
Packit Bot a3ac83
     does not identify any Invariant Sections then there are none.
Packit Bot a3ac83
Packit Bot a3ac83
     The "Cover Texts" are certain short passages of text that are
Packit Bot a3ac83
     listed, as Front-Cover Texts or Back-Cover Texts, in the notice
Packit Bot a3ac83
     that says that the Document is released under this License.  A
Packit Bot a3ac83
     Front-Cover Text may be at most 5 words, and a Back-Cover Text may
Packit Bot a3ac83
     be at most 25 words.
Packit Bot a3ac83
Packit Bot a3ac83
     A "Transparent" copy of the Document means a machine-readable copy,
Packit Bot a3ac83
     represented in a format whose specification is available to the
Packit Bot a3ac83
     general public, that is suitable for revising the document
Packit Bot a3ac83
     straightforwardly with generic text editors or (for images
Packit Bot a3ac83
     composed of pixels) generic paint programs or (for drawings) some
Packit Bot a3ac83
     widely available drawing editor, and that is suitable for input to
Packit Bot a3ac83
     text formatters or for automatic translation to a variety of
Packit Bot a3ac83
     formats suitable for input to text formatters.  A copy made in an
Packit Bot a3ac83
     otherwise Transparent file format whose markup, or absence of
Packit Bot a3ac83
     markup, has been arranged to thwart or discourage subsequent
Packit Bot a3ac83
     modification by readers is not Transparent.  An image format is
Packit Bot a3ac83
     not Transparent if used for any substantial amount of text.  A
Packit Bot a3ac83
     copy that is not "Transparent" is called "Opaque".
Packit Bot a3ac83
Packit Bot a3ac83
     Examples of suitable formats for Transparent copies include plain
Packit Bot a3ac83
     ASCII without markup, Texinfo input format, LaTeX input format,
Packit Bot a3ac83
     SGML or XML using a publicly available DTD, and
Packit Bot a3ac83
     standard-conforming simple HTML, PostScript or PDF designed for
Packit Bot a3ac83
     human modification.  Examples of transparent image formats include
Packit Bot a3ac83
     PNG, XCF and JPG.  Opaque formats include proprietary formats that
Packit Bot a3ac83
     can be read and edited only by proprietary word processors, SGML or
Packit Bot a3ac83
     XML for which the DTD and/or processing tools are not generally
Packit Bot a3ac83
     available, and the machine-generated HTML, PostScript or PDF
Packit Bot a3ac83
     produced by some word processors for output purposes only.
Packit Bot a3ac83
Packit Bot a3ac83
     The "Title Page" means, for a printed book, the title page itself,
Packit Bot a3ac83
     plus such following pages as are needed to hold, legibly, the
Packit Bot a3ac83
     material this License requires to appear in the title page.  For
Packit Bot a3ac83
     works in formats which do not have any title page as such, "Title
Packit Bot a3ac83
     Page" means the text near the most prominent appearance of the
Packit Bot a3ac83
     work's title, preceding the beginning of the body of the text.
Packit Bot a3ac83
Packit Bot a3ac83
     The "publisher" means any person or entity that distributes copies
Packit Bot a3ac83
     of the Document to the public.
Packit Bot a3ac83
Packit Bot a3ac83
     A section "Entitled XYZ" means a named subunit of the Document
Packit Bot a3ac83
     whose title either is precisely XYZ or contains XYZ in parentheses
Packit Bot a3ac83
     following text that translates XYZ in another language.  (Here XYZ
Packit Bot a3ac83
     stands for a specific section name mentioned below, such as
Packit Bot a3ac83
     "Acknowledgements", "Dedications", "Endorsements", or "History".)
Packit Bot a3ac83
     To "Preserve the Title" of such a section when you modify the
Packit Bot a3ac83
     Document means that it remains a section "Entitled XYZ" according
Packit Bot a3ac83
     to this definition.
Packit Bot a3ac83
Packit Bot a3ac83
     The Document may include Warranty Disclaimers next to the notice
Packit Bot a3ac83
     which states that this License applies to the Document.  These
Packit Bot a3ac83
     Warranty Disclaimers are considered to be included by reference in
Packit Bot a3ac83
     this License, but only as regards disclaiming warranties: any other
Packit Bot a3ac83
     implication that these Warranty Disclaimers may have is void and
Packit Bot a3ac83
     has no effect on the meaning of this License.
Packit Bot a3ac83
Packit Bot a3ac83
  2. VERBATIM COPYING
Packit Bot a3ac83
Packit Bot a3ac83
     You may copy and distribute the Document in any medium, either
Packit Bot a3ac83
     commercially or noncommercially, provided that this License, the
Packit Bot a3ac83
     copyright notices, and the license notice saying this License
Packit Bot a3ac83
     applies to the Document are reproduced in all copies, and that you
Packit Bot a3ac83
     add no other conditions whatsoever to those of this License.  You
Packit Bot a3ac83
     may not use technical measures to obstruct or control the reading
Packit Bot a3ac83
     or further copying of the copies you make or distribute.  However,
Packit Bot a3ac83
     you may accept compensation in exchange for copies.  If you
Packit Bot a3ac83
     distribute a large enough number of copies you must also follow
Packit Bot a3ac83
     the conditions in section 3.
Packit Bot a3ac83
Packit Bot a3ac83
     You may also lend copies, under the same conditions stated above,
Packit Bot a3ac83
     and you may publicly display copies.
Packit Bot a3ac83
Packit Bot a3ac83
  3. COPYING IN QUANTITY
Packit Bot a3ac83
Packit Bot a3ac83
     If you publish printed copies (or copies in media that commonly
Packit Bot a3ac83
     have printed covers) of the Document, numbering more than 100, and
Packit Bot a3ac83
     the Document's license notice requires Cover Texts, you must
Packit Bot a3ac83
     enclose the copies in covers that carry, clearly and legibly, all
Packit Bot a3ac83
     these Cover Texts: Front-Cover Texts on the front cover, and
Packit Bot a3ac83
     Back-Cover Texts on the back cover.  Both covers must also clearly
Packit Bot a3ac83
     and legibly identify you as the publisher of these copies.  The
Packit Bot a3ac83
     front cover must present the full title with all words of the
Packit Bot a3ac83
     title equally prominent and visible.  You may add other material
Packit Bot a3ac83
     on the covers in addition.  Copying with changes limited to the
Packit Bot a3ac83
     covers, as long as they preserve the title of the Document and
Packit Bot a3ac83
     satisfy these conditions, can be treated as verbatim copying in
Packit Bot a3ac83
     other respects.
Packit Bot a3ac83
Packit Bot a3ac83
     If the required texts for either cover are too voluminous to fit
Packit Bot a3ac83
     legibly, you should put the first ones listed (as many as fit
Packit Bot a3ac83
     reasonably) on the actual cover, and continue the rest onto
Packit Bot a3ac83
     adjacent pages.
Packit Bot a3ac83
Packit Bot a3ac83
     If you publish or distribute Opaque copies of the Document
Packit Bot a3ac83
     numbering more than 100, you must either include a
Packit Bot a3ac83
     machine-readable Transparent copy along with each Opaque copy, or
Packit Bot a3ac83
     state in or with each Opaque copy a computer-network location from
Packit Bot a3ac83
     which the general network-using public has access to download
Packit Bot a3ac83
     using public-standard network protocols a complete Transparent
Packit Bot a3ac83
     copy of the Document, free of added material.  If you use the
Packit Bot a3ac83
     latter option, you must take reasonably prudent steps, when you
Packit Bot a3ac83
     begin distribution of Opaque copies in quantity, to ensure that
Packit Bot a3ac83
     this Transparent copy will remain thus accessible at the stated
Packit Bot a3ac83
     location until at least one year after the last time you
Packit Bot a3ac83
     distribute an Opaque copy (directly or through your agents or
Packit Bot a3ac83
     retailers) of that edition to the public.
Packit Bot a3ac83
Packit Bot a3ac83
     It is requested, but not required, that you contact the authors of
Packit Bot a3ac83
     the Document well before redistributing any large number of
Packit Bot a3ac83
     copies, to give them a chance to provide you with an updated
Packit Bot a3ac83
     version of the Document.
Packit Bot a3ac83
Packit Bot a3ac83
  4. MODIFICATIONS
Packit Bot a3ac83
Packit Bot a3ac83
     You may copy and distribute a Modified Version of the Document
Packit Bot a3ac83
     under the conditions of sections 2 and 3 above, provided that you
Packit Bot a3ac83
     release the Modified Version under precisely this License, with
Packit Bot a3ac83
     the Modified Version filling the role of the Document, thus
Packit Bot a3ac83
     licensing distribution and modification of the Modified Version to
Packit Bot a3ac83
     whoever possesses a copy of it.  In addition, you must do these
Packit Bot a3ac83
     things in the Modified Version:
Packit Bot a3ac83
Packit Bot a3ac83
       A. Use in the Title Page (and on the covers, if any) a title
Packit Bot a3ac83
          distinct from that of the Document, and from those of
Packit Bot a3ac83
          previous versions (which should, if there were any, be listed
Packit Bot a3ac83
          in the History section of the Document).  You may use the
Packit Bot a3ac83
          same title as a previous version if the original publisher of
Packit Bot a3ac83
          that version gives permission.
Packit Bot a3ac83
Packit Bot a3ac83
       B. List on the Title Page, as authors, one or more persons or
Packit Bot a3ac83
          entities responsible for authorship of the modifications in
Packit Bot a3ac83
          the Modified Version, together with at least five of the
Packit Bot a3ac83
          principal authors of the Document (all of its principal
Packit Bot a3ac83
          authors, if it has fewer than five), unless they release you
Packit Bot a3ac83
          from this requirement.
Packit Bot a3ac83
Packit Bot a3ac83
       C. State on the Title page the name of the publisher of the
Packit Bot a3ac83
          Modified Version, as the publisher.
Packit Bot a3ac83
Packit Bot a3ac83
       D. Preserve all the copyright notices of the Document.
Packit Bot a3ac83
Packit Bot a3ac83
       E. Add an appropriate copyright notice for your modifications
Packit Bot a3ac83
          adjacent to the other copyright notices.
Packit Bot a3ac83
Packit Bot a3ac83
       F. Include, immediately after the copyright notices, a license
Packit Bot a3ac83
          notice giving the public permission to use the Modified
Packit Bot a3ac83
          Version under the terms of this License, in the form shown in
Packit Bot a3ac83
          the Addendum below.
Packit Bot a3ac83
Packit Bot a3ac83
       G. Preserve in that license notice the full lists of Invariant
Packit Bot a3ac83
          Sections and required Cover Texts given in the Document's
Packit Bot a3ac83
          license notice.
Packit Bot a3ac83
Packit Bot a3ac83
       H. Include an unaltered copy of this License.
Packit Bot a3ac83
Packit Bot a3ac83
       I. Preserve the section Entitled "History", Preserve its Title,
Packit Bot a3ac83
          and add to it an item stating at least the title, year, new
Packit Bot a3ac83
          authors, and publisher of the Modified Version as given on
Packit Bot a3ac83
          the Title Page.  If there is no section Entitled "History" in
Packit Bot a3ac83
          the Document, create one stating the title, year, authors,
Packit Bot a3ac83
          and publisher of the Document as given on its Title Page,
Packit Bot a3ac83
          then add an item describing the Modified Version as stated in
Packit Bot a3ac83
          the previous sentence.
Packit Bot a3ac83
Packit Bot a3ac83
       J. Preserve the network location, if any, given in the Document
Packit Bot a3ac83
          for public access to a Transparent copy of the Document, and
Packit Bot a3ac83
          likewise the network locations given in the Document for
Packit Bot a3ac83
          previous versions it was based on.  These may be placed in
Packit Bot a3ac83
          the "History" section.  You may omit a network location for a
Packit Bot a3ac83
          work that was published at least four years before the
Packit Bot a3ac83
          Document itself, or if the original publisher of the version
Packit Bot a3ac83
          it refers to gives permission.
Packit Bot a3ac83
Packit Bot a3ac83
       K. For any section Entitled "Acknowledgements" or "Dedications",
Packit Bot a3ac83
          Preserve the Title of the section, and preserve in the
Packit Bot a3ac83
          section all the substance and tone of each of the contributor
Packit Bot a3ac83
          acknowledgements and/or dedications given therein.
Packit Bot a3ac83
Packit Bot a3ac83
       L. Preserve all the Invariant Sections of the Document,
Packit Bot a3ac83
          unaltered in their text and in their titles.  Section numbers
Packit Bot a3ac83
          or the equivalent are not considered part of the section
Packit Bot a3ac83
          titles.
Packit Bot a3ac83
Packit Bot a3ac83
       M. Delete any section Entitled "Endorsements".  Such a section
Packit Bot a3ac83
          may not be included in the Modified Version.
Packit Bot a3ac83
Packit Bot a3ac83
       N. Do not retitle any existing section to be Entitled
Packit Bot a3ac83
          "Endorsements" or to conflict in title with any Invariant
Packit Bot a3ac83
          Section.
Packit Bot a3ac83
Packit Bot a3ac83
       O. Preserve any Warranty Disclaimers.
Packit Bot a3ac83
Packit Bot a3ac83
     If the Modified Version includes new front-matter sections or
Packit Bot a3ac83
     appendices that qualify as Secondary Sections and contain no
Packit Bot a3ac83
     material copied from the Document, you may at your option
Packit Bot a3ac83
     designate some or all of these sections as invariant.  To do this,
Packit Bot a3ac83
     add their titles to the list of Invariant Sections in the Modified
Packit Bot a3ac83
     Version's license notice.  These titles must be distinct from any
Packit Bot a3ac83
     other section titles.
Packit Bot a3ac83
Packit Bot a3ac83
     You may add a section Entitled "Endorsements", provided it contains
Packit Bot a3ac83
     nothing but endorsements of your Modified Version by various
Packit Bot a3ac83
     parties--for example, statements of peer review or that the text
Packit Bot a3ac83
     has been approved by an organization as the authoritative
Packit Bot a3ac83
     definition of a standard.
Packit Bot a3ac83
Packit Bot a3ac83
     You may add a passage of up to five words as a Front-Cover Text,
Packit Bot a3ac83
     and a passage of up to 25 words as a Back-Cover Text, to the end
Packit Bot a3ac83
     of the list of Cover Texts in the Modified Version.  Only one
Packit Bot a3ac83
     passage of Front-Cover Text and one of Back-Cover Text may be
Packit Bot a3ac83
     added by (or through arrangements made by) any one entity.  If the
Packit Bot a3ac83
     Document already includes a cover text for the same cover,
Packit Bot a3ac83
     previously added by you or by arrangement made by the same entity
Packit Bot a3ac83
     you are acting on behalf of, you may not add another; but you may
Packit Bot a3ac83
     replace the old one, on explicit permission from the previous
Packit Bot a3ac83
     publisher that added the old one.
Packit Bot a3ac83
Packit Bot a3ac83
     The author(s) and publisher(s) of the Document do not by this
Packit Bot a3ac83
     License give permission to use their names for publicity for or to
Packit Bot a3ac83
     assert or imply endorsement of any Modified Version.
Packit Bot a3ac83
Packit Bot a3ac83
  5. COMBINING DOCUMENTS
Packit Bot a3ac83
Packit Bot a3ac83
     You may combine the Document with other documents released under
Packit Bot a3ac83
     this License, under the terms defined in section 4 above for
Packit Bot a3ac83
     modified versions, provided that you include in the combination
Packit Bot a3ac83
     all of the Invariant Sections of all of the original documents,
Packit Bot a3ac83
     unmodified, and list them all as Invariant Sections of your
Packit Bot a3ac83
     combined work in its license notice, and that you preserve all
Packit Bot a3ac83
     their Warranty Disclaimers.
Packit Bot a3ac83
Packit Bot a3ac83
     The combined work need only contain one copy of this License, and
Packit Bot a3ac83
     multiple identical Invariant Sections may be replaced with a single
Packit Bot a3ac83
     copy.  If there are multiple Invariant Sections with the same name
Packit Bot a3ac83
     but different contents, make the title of each such section unique
Packit Bot a3ac83
     by adding at the end of it, in parentheses, the name of the
Packit Bot a3ac83
     original author or publisher of that section if known, or else a
Packit Bot a3ac83
     unique number.  Make the same adjustment to the section titles in
Packit Bot a3ac83
     the list of Invariant Sections in the license notice of the
Packit Bot a3ac83
     combined work.
Packit Bot a3ac83
Packit Bot a3ac83
     In the combination, you must combine any sections Entitled
Packit Bot a3ac83
     "History" in the various original documents, forming one section
Packit Bot a3ac83
     Entitled "History"; likewise combine any sections Entitled
Packit Bot a3ac83
     "Acknowledgements", and any sections Entitled "Dedications".  You
Packit Bot a3ac83
     must delete all sections Entitled "Endorsements."
Packit Bot a3ac83
Packit Bot a3ac83
  6. COLLECTIONS OF DOCUMENTS
Packit Bot a3ac83
Packit Bot a3ac83
     You may make a collection consisting of the Document and other
Packit Bot a3ac83
     documents released under this License, and replace the individual
Packit Bot a3ac83
     copies of this License in the various documents with a single copy
Packit Bot a3ac83
     that is included in the collection, provided that you follow the
Packit Bot a3ac83
     rules of this License for verbatim copying of each of the
Packit Bot a3ac83
     documents in all other respects.
Packit Bot a3ac83
Packit Bot a3ac83
     You may extract a single document from such a collection, and
Packit Bot a3ac83
     distribute it individually under this License, provided you insert
Packit Bot a3ac83
     a copy of this License into the extracted document, and follow
Packit Bot a3ac83
     this License in all other respects regarding verbatim copying of
Packit Bot a3ac83
     that document.
Packit Bot a3ac83
Packit Bot a3ac83
  7. AGGREGATION WITH INDEPENDENT WORKS
Packit Bot a3ac83
Packit Bot a3ac83
     A compilation of the Document or its derivatives with other
Packit Bot a3ac83
     separate and independent documents or works, in or on a volume of
Packit Bot a3ac83
     a storage or distribution medium, is called an "aggregate" if the
Packit Bot a3ac83
     copyright resulting from the compilation is not used to limit the
Packit Bot a3ac83
     legal rights of the compilation's users beyond what the individual
Packit Bot a3ac83
     works permit.  When the Document is included in an aggregate, this
Packit Bot a3ac83
     License does not apply to the other works in the aggregate which
Packit Bot a3ac83
     are not themselves derivative works of the Document.
Packit Bot a3ac83
Packit Bot a3ac83
     If the Cover Text requirement of section 3 is applicable to these
Packit Bot a3ac83
     copies of the Document, then if the Document is less than one half
Packit Bot a3ac83
     of the entire aggregate, the Document's Cover Texts may be placed
Packit Bot a3ac83
     on covers that bracket the Document within the aggregate, or the
Packit Bot a3ac83
     electronic equivalent of covers if the Document is in electronic
Packit Bot a3ac83
     form.  Otherwise they must appear on printed covers that bracket
Packit Bot a3ac83
     the whole aggregate.
Packit Bot a3ac83
Packit Bot a3ac83
  8. TRANSLATION
Packit Bot a3ac83
Packit Bot a3ac83
     Translation is considered a kind of modification, so you may
Packit Bot a3ac83
     distribute translations of the Document under the terms of section
Packit Bot a3ac83
     4.  Replacing Invariant Sections with translations requires special
Packit Bot a3ac83
     permission from their copyright holders, but you may include
Packit Bot a3ac83
     translations of some or all Invariant Sections in addition to the
Packit Bot a3ac83
     original versions of these Invariant Sections.  You may include a
Packit Bot a3ac83
     translation of this License, and all the license notices in the
Packit Bot a3ac83
     Document, and any Warranty Disclaimers, provided that you also
Packit Bot a3ac83
     include the original English version of this License and the
Packit Bot a3ac83
     original versions of those notices and disclaimers.  In case of a
Packit Bot a3ac83
     disagreement between the translation and the original version of
Packit Bot a3ac83
     this License or a notice or disclaimer, the original version will
Packit Bot a3ac83
     prevail.
Packit Bot a3ac83
Packit Bot a3ac83
     If a section in the Document is Entitled "Acknowledgements",
Packit Bot a3ac83
     "Dedications", or "History", the requirement (section 4) to
Packit Bot a3ac83
     Preserve its Title (section 1) will typically require changing the
Packit Bot a3ac83
     actual title.
Packit Bot a3ac83
Packit Bot a3ac83
  9. TERMINATION
Packit Bot a3ac83
Packit Bot a3ac83
     You may not copy, modify, sublicense, or distribute the Document
Packit Bot a3ac83
     except as expressly provided under this License.  Any attempt
Packit Bot a3ac83
     otherwise to copy, modify, sublicense, or distribute it is void,
Packit Bot a3ac83
     and will automatically terminate your rights under this License.
Packit Bot a3ac83
Packit Bot a3ac83
     However, if you cease all violation of this License, then your
Packit Bot a3ac83
     license from a particular copyright holder is reinstated (a)
Packit Bot a3ac83
     provisionally, unless and until the copyright holder explicitly
Packit Bot a3ac83
     and finally terminates your license, and (b) permanently, if the
Packit Bot a3ac83
     copyright holder fails to notify you of the violation by some
Packit Bot a3ac83
     reasonable means prior to 60 days after the cessation.
Packit Bot a3ac83
Packit Bot a3ac83
     Moreover, your license from a particular copyright holder is
Packit Bot a3ac83
     reinstated permanently if the copyright holder notifies you of the
Packit Bot a3ac83
     violation by some reasonable means, this is the first time you have
Packit Bot a3ac83
     received notice of violation of this License (for any work) from
Packit Bot a3ac83
     that copyright holder, and you cure the violation prior to 30 days
Packit Bot a3ac83
     after your receipt of the notice.
Packit Bot a3ac83
Packit Bot a3ac83
     Termination of your rights under this section does not terminate
Packit Bot a3ac83
     the licenses of parties who have received copies or rights from
Packit Bot a3ac83
     you under this License.  If your rights have been terminated and
Packit Bot a3ac83
     not permanently reinstated, receipt of a copy of some or all of
Packit Bot a3ac83
     the same material does not give you any rights to use it.
Packit Bot a3ac83
Packit Bot a3ac83
 10. FUTURE REVISIONS OF THIS LICENSE
Packit Bot a3ac83
Packit Bot a3ac83
     The Free Software Foundation may publish new, revised versions of
Packit Bot a3ac83
     the GNU Free Documentation License from time to time.  Such new
Packit Bot a3ac83
     versions will be similar in spirit to the present version, but may
Packit Bot a3ac83
     differ in detail to address new problems or concerns.  See
Packit Bot a3ac83
     'http://www.gnu.org/copyleft/'.
Packit Bot a3ac83
Packit Bot a3ac83
     Each version of the License is given a distinguishing version
Packit Bot a3ac83
     number.  If the Document specifies that a particular numbered
Packit Bot a3ac83
     version of this License "or any later version" applies to it, you
Packit Bot a3ac83
     have the option of following the terms and conditions either of
Packit Bot a3ac83
     that specified version or of any later version that has been
Packit Bot a3ac83
     published (not as a draft) by the Free Software Foundation.  If
Packit Bot a3ac83
     the Document does not specify a version number of this License,
Packit Bot a3ac83
     you may choose any version ever published (not as a draft) by the
Packit Bot a3ac83
     Free Software Foundation.  If the Document specifies that a proxy
Packit Bot a3ac83
     can decide which future versions of this License can be used, that
Packit Bot a3ac83
     proxy's public statement of acceptance of a version permanently
Packit Bot a3ac83
     authorizes you to choose that version for the Document.
Packit Bot a3ac83
Packit Bot a3ac83
 11. RELICENSING
Packit Bot a3ac83
Packit Bot a3ac83
     "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
Packit Bot a3ac83
     World Wide Web server that publishes copyrightable works and also
Packit Bot a3ac83
     provides prominent facilities for anybody to edit those works.  A
Packit Bot a3ac83
     public wiki that anybody can edit is an example of such a server.
Packit Bot a3ac83
     A "Massive Multiauthor Collaboration" (or "MMC") contained in the
Packit Bot a3ac83
     site means any set of copyrightable works thus published on the MMC
Packit Bot a3ac83
     site.
Packit Bot a3ac83
Packit Bot a3ac83
     "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
Packit Bot a3ac83
     license published by Creative Commons Corporation, a not-for-profit
Packit Bot a3ac83
     corporation with a principal place of business in San Francisco,
Packit Bot a3ac83
     California, as well as future copyleft versions of that license
Packit Bot a3ac83
     published by that same organization.
Packit Bot a3ac83
Packit Bot a3ac83
     "Incorporate" means to publish or republish a Document, in whole or
Packit Bot a3ac83
     in part, as part of another Document.
Packit Bot a3ac83
Packit Bot a3ac83
     An MMC is "eligible for relicensing" if it is licensed under this
Packit Bot a3ac83
     License, and if all works that were first published under this
Packit Bot a3ac83
     License somewhere other than this MMC, and subsequently
Packit Bot a3ac83
     incorporated in whole or in part into the MMC, (1) had no cover
Packit Bot a3ac83
     texts or invariant sections, and (2) were thus incorporated prior
Packit Bot a3ac83
     to November 1, 2008.
Packit Bot a3ac83
Packit Bot a3ac83
     The operator of an MMC Site may republish an MMC contained in the
Packit Bot a3ac83
     site under CC-BY-SA on the same site at any time before August 1,
Packit Bot a3ac83
     2009, provided the MMC is eligible for relicensing.
Packit Bot a3ac83
Packit Bot a3ac83
Packit Bot a3ac83
ADDENDUM: How to use this License for your documents
Packit Bot a3ac83
====================================================
Packit Bot a3ac83
Packit Bot a3ac83
To use this License in a document you have written, include a copy of
Packit Bot a3ac83
the License in the document and put the following copyright and license
Packit Bot a3ac83
notices just after the title page:
Packit Bot a3ac83
Packit Bot a3ac83
       Copyright (C)  YEAR  YOUR NAME.
Packit Bot a3ac83
       Permission is granted to copy, distribute and/or modify this document
Packit Bot a3ac83
       under the terms of the GNU Free Documentation License, Version 1.3
Packit Bot a3ac83
       or any later version published by the Free Software Foundation;
Packit Bot a3ac83
       with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
Packit Bot a3ac83
       Texts.  A copy of the license is included in the section entitled ``GNU
Packit Bot a3ac83
       Free Documentation License''.
Packit Bot a3ac83
Packit Bot a3ac83
   If you have Invariant Sections, Front-Cover Texts and Back-Cover
Packit Bot a3ac83
Texts, replace the "with...Texts." line with this:
Packit Bot a3ac83
Packit Bot a3ac83
         with the Invariant Sections being LIST THEIR TITLES, with
Packit Bot a3ac83
         the Front-Cover Texts being LIST, and with the Back-Cover Texts
Packit Bot a3ac83
         being LIST.
Packit Bot a3ac83
Packit Bot a3ac83
   If you have Invariant Sections without Cover Texts, or some other
Packit Bot a3ac83
combination of the three, merge those two alternatives to suit the
Packit Bot a3ac83
situation.
Packit Bot a3ac83
Packit Bot a3ac83
   If your document contains nontrivial examples of program code, we
Packit Bot a3ac83
recommend releasing these examples in parallel under your choice of
Packit Bot a3ac83
free software license, such as the GNU General Public License, to
Packit Bot a3ac83
permit their use in free software.
Packit Bot a3ac83
Packit Bot a3ac83
Packit Bot a3ac83
?
Packit Bot a3ac83
Tag Table:
Packit Bot a3ac83
Node: Top535
Packit Bot a3ac83
Node: Overview2198
Packit Bot a3ac83
Node: Introduction to line editing4254
Packit Bot a3ac83
Node: Invoking ed11527
Packit Bot a3ac83
Node: Line addressing13529
Packit Bot a3ac83
Node: Regular expressions17242
Packit Bot a3ac83
Node: Commands22586
Packit Bot a3ac83
Ref: shell escape command36495
Packit Bot a3ac83
Node: Limitations37517
Packit Bot a3ac83
Node: Diagnostics38162
Packit Bot a3ac83
Node: Problems38807
Packit Bot a3ac83
Node: GNU Free Documentation License39340
Packit Bot a3ac83
?
Packit Bot a3ac83
End Tag Table
Packit Bot a3ac83
Packit Bot a3ac83
?
Packit Bot a3ac83
Local Variables:
Packit Bot a3ac83
coding: iso-8859-15
Packit Bot a3ac83
End: