ED(1)
π NAME π
ed β text editor. This is ED(1) from the User Contributed Perl Documentation collection, bestie β okay so letβs get into it! π«Άβ¨
πΈ SYNOPSIS πΈ
ed [-p prompt] [-s] [file]
π DESCRIPTION π
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. Do not come for address 0, periodt. π
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. Thatβs an error, bestie β no cap. π
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. π«Ά
β¨ OPTIONS β¨
The following options are available:
-p STRINGβ Use the specified STRING as a command prompt. By default no prompt is displayed. π¬-sβ Suppress byte counts and diagnostics. π€«
π EDITOR COMMANDS π
aβ Append text. βοΈcβ Change text. πdβ Delete text. ποΈE FILEβ Forcedecommand; suppress warning prompt. π€e FILEβ Load and edit the named FILE argument. πf [FILE]β Show/set a filename. π·οΈHβ Toggle help mode; this causes descriptive errors to be displayed. πhβ Display last error. π¨iβ Insert text. π±jβ Join a range of lines into a single line. The current address is set to the destination address. πkCHβ Mark an address with the lowercase letter CH. The mark can then be used as'CHin place of an address. πlβ Print lines with escape sequences for non-printable characters. πmβ Move a range of lines to a new address. The current address is set to the last line moved. πnβ Print from buffer with line number prefix. π’Pβ Toggle command prompt mode. A string provided by-pwill be used; otherwise, the default is'*'. βpβ Print from buffer. π¨οΈQβ Forcedqcommand; suppress warning prompt. π€qβ Quit program. πr FILEβ Read named FILE into buffer. π₯/PATTERNβ Search for PATTERN in the buffer, starting from the current line. If no pattern is given the previous search is repeated. π?PATTERNβ Search backwards for PATTERN in the buffer, starting from the current line. If no pattern is given the previous search is repeated. πg/PATTERN/CMDβ Search globally in buffer for PATTERN and run command CMD on each matching line. CMD is one of the following commands:'d','l','n','p'and's'. CMD can be omitted. πv/PATTERN/CMDβ Repeatedly run command CMD for each line in the buffer not matching PATTERN. CMD is one of the following commands:'d','l','n','p'and's'. CMD can be omitted. πs///β Substitute text with a regular expression. πtβ Copy (transfer) lines to a destination address. The current address is set to the last line copied. πuβ Undo the last command, restoring the editor buffer to its previous state. The current address is set to what it was before the previous command. The undo function is its own inverse, so multiple levels of undo are not possible. No stacking undo levels, sorry bestie β itβs its own inverse. β©οΈW [FILE]β Write buffer to file in append mode. βw [FILE]β Write buffer to file. πΎwq [FILE]β Write buffer to file, then quit. πͺ=β Display current line number. π
π EXIT STATUS π
0β All commands were processed successfully. β1β An error occurred. β
π AUTHOR π
Written by George M Jones. π«‘
π Cute sign-off time: the footerβs source/version is perl v5.42.2, dated 2026-02-15 β and yes, this is the ED(1) page, bestie! π«Άβ¨
π¦ where this page comes from
- alpine 3.24: perl-power-tools-doc 1.053-r1 Β· GPL-2.0-or-later AND Artistic-1.0-Perl AND Artistic-2.0 AND BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms