The "ed" Editor

These are commands from the "ed" editor used in "vi" by escaping the insert/add mode, typing a full colon, ":" and then the command.

:w writes the file to memory

:wq writes and quits the file

:set nu set numbers (screen numbers)

:set list shows carriage returns and tab inserts

:23,52d deletes lines noted

:23,52m66 moves lines to new location in file

:23,52w newfile writes lines into newfile

:35r filename writes file named into current file at line#

:rew! "rewinds" the file back to last "write"

:g/oldword/s//neword/g global substitution -- new for old

This last set of instructions allows you to search a file for a particular character or series of characters called a "string". They are used after escaping the insert/add mode and are initiated with a slash"/" or a question mark "?", followed by the string.

/string searches from current cursor position forward

?string searches from current position backward

n Find next occurrence

? Find previous occurrence

[NOTE: all of these commands are echoed or printed on the terminal at the lower left hand corner of the screen. If the characters are not appearing there, you are not doing something right]


(c)Copyright 1985, 1996 by Bruce Jones
Anyone is free to reproduce any of these documents in their entirety or parts thereof providing:
  1. Sections used are reproduced entirely and without alteration
  2. The following page footer is reproduced on each page:
    BJ's UNIX Primer - (c) Bruce Jones - 1985, 1996
  3. Full credit is noted somewhere in the reproduction
Bruce Jones 			Department of Communication
bjones@ucsd.edu			University of California, San Diego
(619) 534-0417/4410		9500 Gilman Drive
FAX (619) 534-7315		La Jolla, Ca. 92093-0503

Comments to: bjones@ucsd.edu


Return to:
Bruce Jones Homepage
BJ's Unix Primer Index
The CommWeb Homepage

This page last updated on: Feb 3 1997