2016-07-10 10:59:29 +01:00
|
|
|
# ed
|
|
|
|
|
|
|
|
> The original Unix text editor.
|
2022-08-15 10:53:12 +10:00
|
|
|
> See also: `awk`, `sed`.
|
2022-03-09 01:28:57 -03:00
|
|
|
> More information: <https://www.gnu.org/software/ed/manual/ed_manual.html>.
|
2016-07-10 10:59:29 +01:00
|
|
|
|
2022-08-15 10:53:12 +10:00
|
|
|
- Start an interactive editor session with an empty document:
|
2016-07-10 10:59:29 +01:00
|
|
|
|
|
|
|
`ed`
|
|
|
|
|
2022-08-15 10:53:12 +10:00
|
|
|
- Start an interactive editor session with an empty document and a specific prompt:
|
2016-07-10 10:59:29 +01:00
|
|
|
|
2025-03-12 21:05:58 +02:00
|
|
|
`ed {{[-p|--prompt]}} '{{> }}'`
|
2016-07-10 10:59:29 +01:00
|
|
|
|
2022-08-15 10:53:12 +10:00
|
|
|
- Start an interactive editor session with user-friendly errors:
|
2016-07-10 10:59:29 +01:00
|
|
|
|
2025-03-12 21:05:58 +02:00
|
|
|
`ed {{[-v|--verbose]}}`
|
2016-07-10 10:59:29 +01:00
|
|
|
|
2022-08-15 10:53:12 +10:00
|
|
|
- Start an interactive editor session with an empty document and without diagnostics, byte counts and '!' prompt:
|
2016-07-10 10:59:29 +01:00
|
|
|
|
2025-03-12 21:05:58 +02:00
|
|
|
`ed {{[-q|--quiet]}}`
|
2016-07-10 10:59:29 +01:00
|
|
|
|
2022-08-15 10:53:12 +10:00
|
|
|
- Start an interactive editor session without exit status change when command fails:
|
2016-07-10 10:59:29 +01:00
|
|
|
|
2025-03-12 21:05:58 +02:00
|
|
|
`ed {{[-l|--loose-exit-status]}}`
|
2016-07-10 10:59:29 +01:00
|
|
|
|
2022-08-15 10:53:12 +10:00
|
|
|
- Edit a specific file (this shows the byte count of the loaded file):
|
2016-07-10 10:59:29 +01:00
|
|
|
|
2022-08-15 10:53:12 +10:00
|
|
|
`ed {{path/to/file}}`
|
2016-07-10 10:59:29 +01:00
|
|
|
|
2022-08-15 10:53:12 +10:00
|
|
|
- Replace a string with a specific replacement for all lines:
|
2016-07-10 10:59:29 +01:00
|
|
|
|
2025-03-12 21:05:58 +02:00
|
|
|
`,s/{{regular_expression}}/{{replacement}}/g<Enter>`
|
|
|
|
|
|
|
|
- Exit ed:
|
|
|
|
|
|
|
|
`q<Enter>`
|