If you are already familiar with global edits in other
, you know most of what you need to
know to begin to use
. There are two things, though, that
make it very different:
It doesn't change the file it edits.
It is just what its name says:
;;itor"-designed to take a stream of data
standard input (
or a file, transform it, and pass it to
standard output (
If you want to edit a file, you have to write a
shell wrapper (
to capture standard output and write it back into your original file.
commands are implicitly global. In an editor like
, the command:
will change "old" to "new" only on the current line unless you use
the global command or various addressing symbols to apply it to
additional lines. In
, exactly the opposite is true.
A command like the one above will be applied to all lines in a file.
Addressing symbols are used to
the extent of the match.
, only the first occurrence of a pattern on
a given line will be changed unless the
flag is added to the
end of the substitution command.)
If all you want to do is make simple substitutions, you're ready to
go. If you want to do more than that,
has some unique and
This chapter makes no attempt to cover everything there is to know
contains a complete quick reference to
commands, with many
examples, because we use so many
scripts elsewhere in this
book, and we need a "dictionary" so beginners can interpret them.
But for the most part, this chapter contains advice on working with
and extended explanations of how to use some of its more