A
          / \      _             Play Now                         Nemesis on fb
          | |     | |  _______   _        _   _______    _______   _    _______
          | |\    | | |   ____| |  \    /  | |   ____|  /   ____| | |  /   ____|
 /-------/-------------------------------------------------------------------,
O= Home <=XX|  About  News  Pics  Adventurers  Wizards  Download  Connect     >
 \-------\-------------------------------------------------------------------'
          | |   \   | |  |____  | |      | | |  |____   ___ \  \  | |  ___ \  \
          | |     \_| |_______| |_|      |_| |_______| |_______/  |_| |_______/
          \ /
           V  

Documentation Area

Document Path: /doc/build/ed


Name: ed - a text editor

Syntax:
	ed
	ed <filename>

Description:
	You can enter ed by typing 'ed <filename>'. You can leave ed by
	typing 'q'. When you are in ed, the prompt is ':'.

	Ed has two modes, command mode and insert mode. The insert mode has
	no prompt. You exit the insert mode by typing a single '.' on a line.

	All commands have the following syntax:  

		X,Ycmd   or   Xcmd

	where X and Y are (line) numbers and cmd is an ed specific command.
	
	Some examples:
	1,10p 		will print line 1 to 10.
	1,5d 		will delete line 1 to 5.
	8p 		will print line 8.

	As line numbers '.' is current line, and '$' is last line of file.
	The current line is the last line referenced.

	.,.+10p		print the last line and 10 more.
	1,$p 		print all of the file.

	Commands that use a line range, if no line is given, then the current
	line is printed:

	p	Print line.
	d	Delete line.
	l	Print line with control characters.
	r file	Read in a file after the line specified.
	s	Substitute patterns. See special documentation.
	z	Print 10 lines.
	a	Start insert mode after specified line. Exit with '.'<return>.
	i	Start insert mode before specified line. Exit with '.'<return>.

	Commands used without line specification:

	q	Quit. Won't work if file is changed.
	Q	Quit and discard all changes if not saved.
	w	Write the file out.
	w file	Write the file out with name 'file'.
	e file	Edit a file.
	!cmd	Give a game command. For example "say Wait, I am busy".

	Searching is done with:

	/hello/		Find first line in of after current line.
	//		will repeat the search.

	Substitutions are very advanced, first some simple examples:

	s/apa/bepa/ 	This will substitute the 'apa' in current line to 'bepa'.
			If an 'p' is appended, you will also immediately see
			the result.
	1,$s/apa/bepa/  Same, but all lines in file. Only first occurence on
			every line.
	s!apa!bepa!g    Any character can used instead of '/', the 'g' speci-
			fies that all occurences of apa on this line are
			changed to bepa.

	The pattern that are supposed to be replaced, can be a regular
	expression:

	.	Match any character.
	x*	Match any numbers of x (0 or more).
	[abc]	Match 'a', 'b' or 'c'.
	[0-9]	Match any digit 0 - 9.
	[a-z]	Match any lowercase letter.
	\x	Match 'x' where 'x' can be any character except '(' and ')'.

	Example:
	s/ab.d/ABCD/ 	Substitute any string 'abXd' against 'ABCD' where X
			can be any character.

	If you want to take a copy from a standard file, enter ed. Then do
	'r /room/vill_green.c'.

	Now you have something in the buffer. Change it into what you want it
	to be. Then 'w /players/peter/hall.c' or 'w hall.c'.

See also:


This page was generated in LPC

Imprint / Impressum