

SEDIT (1)                   11/30/79                    SEDIT (1)




NAME
   sedit - stream editor

SYNOPSIS
   sedit [-n] {[-e script | -f sfile]... | script} [file]...

DESCRIPTION
   Sedit  copies  the  named  input files to the standard output,
   performing editing as directed by sedit commands  in  "script"
   or in "sfile". The -e flag indicates that the next argument is
   to be interpreted as an sedit command (see below). The -f flag
   indicates  that  the  next  argument  is the name of a file in
   which sedit commands appear  one  per  line.  The  -e  and  -f
   arguments may be intermixed in any order. The order of command
   execution is the order in which commands are read. If no -e or
   -f  flags  are  given,  the first argument is used as an sedit
   command. Normally, sedit writes each  line  of  input  to  the
   output  after  editing;  the -n option suppresses this action.
   As a result, the only output  is  that  resulting  from  sedit
   commands.

   When  the  first  argument  not  in  the  scope  of  a flag is
   encountered, it and all  succeeding  arguments  are  taken  as
   input  files.  If  no  files  are given, or if the name "-" is
   specified, the standard input is read.

   Sedit commands have the general form

      line1 [, line2] command arguments

   A line number (line1 or line2) is either a decimal number that
   refers to a specific  input  line  (input  lines  are  counted
   cumulatively across files), a "$" that refers to the last line
   of input, or a /pattern/ where pattern is a regular expression
   (as  in  edit).  Line number 0 may be used to specify commands
   that should be executed before any input is read.

   A command with no line numbers is applied  to  every  line  of
   input. A command with one line number is applied to every line
   of input that matches the line number. A command with two line
   numbers  is  applied to every line of input beginning with the
   first line that matches  line1  through  the  next  line  that
   matches  line2.   Thereafter, the process is repeated, looking
   again for a line that matches line1.

   Sedit accepts the following commands.   Each  command  may  be
   used  with  0,  1, or 2 line numbers. The a, c, and i commands
   may not appear in command line scripts.





SEDIT (1)                   11/30/79                    SEDIT (1)


   a
   <text>
   .
      Append.  The <text> is placed  on  the  output  after  each
      selected  line.  The <text> does not change the line number
      nor is it subject to subsequent sedit commands.

   c
   <text>
   .
      Change.  The selected  lines  are  deleted  and  <text>  is
      placed  on  the  output in their place. The <text> does not
      change the line number nor  is  it  subject  to  subsequent
      sedit commands.

   d
      Delete.  The selected lines are deleted.

   i
   <text>
   .
      Insert.   The  <text>  is  placed on the output before each
      selected line.  The <text> does not change the line  number
      nor is it subject to subsequent sedit commands.

   p
      Print.   The  selected  lines  are  printed on the standard
      output.

   r file
      Read file.  The contents of "file" are placed on the output
      after each selected line exactly as if  the  contents  were
      given  as  <text>  in  an  a command.  The new lines do not
      change the line number nor are they subject  to  subsequent
      sedit commands.

   s/pat/new/gp
      Substitute.    The  leftmost  occurrences  of  pat  in  the
      selected lines is changed to new. If g  is  specified,  all
      occurrences  are changed.  If p is specified, the resulting
      line is printed.

   w file
      Write file.  The selected lines  are  appended  to  "file".
      Files mentioned in w commands are created before processing
      begins.  The  limit  on the number of w commands depends on
      the number of files that can be opened at the same time.

   =
      Print line number.  The current line number is  printed  on
      the output as a line.




SEDIT (1)                   11/30/79                    SEDIT (1)


   Text  appended  by a, c, or r commands is placed on the output
   in the same order as the execution of  the  commands.  Similar
   comments apply to text inserted by i commands.

   Sedit  can  accomodate  commands  totaling  approximately 5000
   characters (including <text> arguments), and lines up  to  120
   characters in length.

SEE ALSO
   edit, change, find, tr

DIAGNOSTICS
   In  addition  to  the usual error messages resulting from file
   access failure, sedit issues the following messages preceeding
   by the offending command line.

   bad line numbers
      indicates that the line number expressions are invalid.

   invalid command
      indicates  that  the  command  preceeding  the  message  is
      illegal.  This message is issued for a, i, or c commands if
      they appear in command string scripts.

   too many commands
      indicates exhaustion of space to hold commands. The size of
      the command buffer is determined by the  MAXBUF  definition
      in the source code.

AUTHOR
   Chris Fraser (U. of Arizona)

BUGS/DEFICIENCIES
   The '$' indicator for end-of-file doesn't always work.




















