ed - text editor
ed [-p prompt] [-dsv] [file]
ed initially reads its input file into a buffer. If no file argument is provided the buffer will be empty. Commands are then entered to display, modify and save the buffer. Line numbers within the buffer are referred to as addresses. Address 1 is the first line in the buffer; address 0 is invalid.
ed keeps track of the current line selected in the buffer. Commands for modifying the buffer can be entered without an explicit address; the current line will be processed. Entering a bare address such as "2" first resets the current line pointer, then prints the line.
Commands are denoted by a single letter. The "p" command prints one or more lines. An address can precede a command, so "2p" first resets the current line pointer then prints the line. This is the same result as for entering the bare address "2"; however, print is explicit.
A command may operate on a range of addresses at once. An address range is entered as two numbers separated by a comma, e.g. "1,10". The numbers are included as the first and last number of the range. So "1,10" spans from line 1 to 10. A range is then used as a command prefix, e.g. "1,2p" will print 2 lines. Addressing a line outside the scope of the buffer results in an error.
The commands "a", "c" and "i" allow text to be entered into the buffer. Text input is terminated by a line containing the single character ".". If an error occurs ed will print "?". The "h" command fetches the saved error message and prints it.
The following options are available:
Print debugging information on standard output.
Use the specified STRING as a command prompt. By default no prompt is displayed.
Suppress byte counts
Print full error messages; equivalent to the "H" command
Append text
Change text
Delete text
Forced "e" command; suppress warning prompt
Load and edit the named FILE argument
Show/set a filename
Toggle help mode; this causes descriptive errors to be displayed
Display last error
Insert text
Join a range of lines into a single line. The current address is set to the destination address.
Print lines with escape sequences for non-printable characters
Move a range of lines to a new address. The current address is set to the last line moved.
Print from buffer with line number prefix
Toggle command prompt mode. A string provided by -p will be used; otherwise, the default is '*'
Print from buffer
Forced "q" command; suppress warning prompt
Quit program
Read named FILE into buffer
Substitute text with a regular expression
Copy (transfer) lines to a destination address. The current address is set to the last line copied.
Write buffer to file in append mode
Write buffer to file
Display current line number
Written by George M Jones
To install PerlPowerTools, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PerlPowerTools
CPAN shell
perl -MCPAN -e shell install PerlPowerTools
For more information on module installation, please visit the detailed CPAN module installation guide.