Matthew Szudzik wrote:
On Thu, Dec 17, 2009 at 07:47:18PM -0500, Brad Tilley wrote:
I use ed in emergencies when /usr is inaccessible, but I'm a lot more
comfortable with vi. Will a static vi ever live in /bin? Helping someone
use ed remotely, who has never used ed, when I myself don't use it
regularly is always an adventure.

If using ed is an "adventure", then you don't really know how to use vi.

ed, sed, and vi are three of the most important Unix utilities, and
there's no excuse for not learning all three.  That's because they all
use the same commands and syntax.  If you know how to use one of them,
then you know how to use the other two.

Each is useful in a slightly different situation.  vi is for interactive
editing.  ed and sed are most useful for writing editing scripts.  ed
reads a file into a buffer for editing and can write those edits back to
the file.  sed works as a filter, reading a stream from standard input
line-by-line and editing each line before writing it to standard output.
Short, one-line sed scripts are useful in command line pipes for
translating the output of one program into the input of another program.

Although most of the basic commands are the same in ed, sed, and vi,
there are subtle differences.  After you have spent some time using ed
and sed, I suggest that you ask yourself the follow questions to test
your understanding of those differences: "When is the global command
(that is, g) useful in ed and vi?  Why is the global command missing
from sed?"


I would like to learn to use sed, however, I did not find that the man page was sufficient as a tutorial. I was not able to find any sed tutorials that were consistent with OpenBSD's variation.

Does anyone know of any sed tutorials that work with OpenBSD's version?

--
A human being should be able to change a diaper, plan an invasion,
butcher a hog, conn a ship, design a building, write a sonnet, balance
accounts, build a wall, set a bone, comfort the dying, take orders,
give orders, cooperate, act alone, solve equations, analyze a new
problem, pitch manure, program a computer, cook a tasty meal, fight
efficiently, die gallantly. Specialization is for insects.
  -- Robert Heinlein

Reply via email to