Showing posts with label shell. Show all posts
Showing posts with label shell. Show all posts

Sunday, 23 September 2012

ED line editor - tutorial


Ed is a line-oriented text editor.

It can be used interactively or in shell scripts.

Ed is the original text editor for Unix. It was written by Ken Thompson in 1971.

Ed is a small editor with few dependencies that can help you edit some files in situations where no other editor is usable.


INSTALLATION (DEBIAN)


$ sudo aptitude install ed
$ which ed
/bin/ed
$ ed # run ed program.


RUNNING ED EDITOR


$ ed file_name # opens file_name for editing. Changes are not stored until w command is introduced.


COMMAND STRUCTURE


Ed works by accepting commands to edit parts of the file.


Commands usually have this structure:

[ADDRESS [,ADDRESS]]COMMAND[PARAMETERS]

Commands are one letter long.

Address means to which lines command is applied to.

Parameters are passed to command.


TOOGLE THE PROMPT