NAME
     sed - stream editor

SYNOPSIS
     sed [ -n ] [ -e command ] [command] [file ...]

DESCRIPTION
     Sed reads lines, applies editing commands to each one, and writes the
     result.  It edits nothing in place: the output goes to the terminal, or
     wherever the shell's > sends it.  It descends from Lee McMahon's stream
     editor, and keeps the smallest useful part of it -- substitute, delete,
     print, quit.

     The commands may be given as one argument, or one at a time with -e; at
     most eight are held.  Files named on the command line are read in turn.
     With none, sed reads the file given by a < redirection.

     Patterns are plain text matched as substrings, not regular expressions.
     /the/ selects lines containing those three letters and nothing more
     clever than that.

OPTIONS
     -n   Print nothing unless a p command asks for it.

     -e command
          Take the next argument as a command.  May be repeated.

COMMANDS
     A command is an optional address, an optional !, and a letter.  With no
     address it applies to every line.

     n    Line n.

     /pattern/
          Lines containing pattern.

     !    Invert the address: apply to the lines it does not select.

     The letters are:

     s/old/new/[g]
          Replace old with new.  Without g only the first occurrence on the
          line is replaced.  Any character may serve as the delimiter in place
          of /; a backslash takes the next character literally.

     d    Delete the line: it is not printed, and no later command sees it.

     p    Print the line.  Useful with -n, and duplicative without it.

     q    Stop reading after this line.

EXAMPLES
     Change a hostname throughout a file:

          sed 's/old.example/bbs.frstcomputer.net/g' /n/local/rc/profile

     Print only the lines that mention the mesh:

          sed -n '/aether/p' /n/local/rc/profile

     Throw away comments and blank-ish lines, and keep the result:

          sed -e '/#/d' -e 's/  */ /g' profile > clean

     Read the first thing said and stop:

          sed 2q /n/local/text/conscience.txt

SEE ALSO
     sam(1), ed(1), grep(1)

NOTES
     Lines longer than 1024 characters are split.

BUGS
     Sed does not read from a pipeline.  The shell passes pipeline data
     through memory rather than a file descriptor, so cat file | sed ...
     prints sed: no input.  Name the file, or redirect it with <.

     A two-address range, addr1,addr2, parses but does not work: only the
     first address is consulted, so the command applies to the lines addr1
     selects and not to the span between the two.

     The address $ is accepted but matches only a last line that has no
     newline after it.  Do not rely on it.

FRST Computer                                                           SED(1)
