SedVi - a powerful command line stream editor inspired by vi


Documentation


Introduction

SedVi is a stream editor, similar in purpose to sed, but with some different capabilities. The script syntax of SedVi is based on the commands used by vi and Vim. If you already know both sed and either vi or Vim, then most parts of this page will probably seem self-evident to you.

SedVi gets its input from either a file, a pipe or directly from the user via the terminal. It only makes sense to use SedVi with textual input. The output can be sent to another file, the same file, to (another) pipe or directly displayed in the terminal. SedVi reads the input line by line into its line buffer. The lines in the buffer are modified by the script which the user provided when starting the program. When the script is finished the line buffer is sent to the output. Then the next line is read from the input and the script starts over again. This cycle is repeated until the last line of the input is processed.

SedVi can easily be combined with other command line tools to perform complex tasks.

Quick tutorial

TODO

Command line arguments

The command line arguments below are already supported in the current development version of SedVi. More options will likely be added soon.

  • -i <input_file>
    Specify the input file. If no input file is specified, input will be read from standard input, i.e. either coming from a pipe or from the terminal.
  • -o <output_file>
    Specify the output file. If no output file is specified, the output will be sent to the standard output, i.e. either a pipe or to the terminal.
  • -a
    Append the SedVi output to the output file instead of overwriting the file.
  • -t
    Write the SedVi output to both the file specified with the '-o' option and the standard output.
  • -sn
    Append all following script arguments to the 'normal' script.
  • -si
    Append all following script arguments to the 'initialize' script.
  • -sb
    Append all following script arguments to the 'begin' script.
  • -sf
    Append all following script arguments to the 'finalize' script.
  • -xm
    Append all following script arguments to the 'move exception' script.
  • -xw
    Append all following script arguments to the 'move word exception' script.
  • -xo
    Append all following script arguments to the 'otherwise exception' script.
  • -N or --no-implicit-write
    Prevent SedVi from automatically writing the line buffer to the output when the script is finished.
  • All other arguments are appended to the currently selected script. The 'normal' script is selected by default.

Script commands

TODO


© 2009, Dave van Soest