From e6fb17a014baf52f06f9171f16eff7e79fa62373 Mon Sep 17 00:00:00 2001 From: Emily Grace Seville Date: Mon, 15 Aug 2022 10:53:12 +1000 Subject: [PATCH] ed: refresh/add pages (#7933) * Update common/ed.md * Create osx/ed.md * Prefer `a specific` * Fix quoting in common/ed * Fix quoting in osx/ed --- pages/common/ed.md | 31 ++++++++++++++----------------- pages/osx/ed.md | 25 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 pages/osx/ed.md diff --git a/pages/common/ed.md b/pages/common/ed.md index ec2bacc2b..dc54074e8 100644 --- a/pages/common/ed.md +++ b/pages/common/ed.md @@ -1,36 +1,33 @@ # ed > The original Unix text editor. +> See also: `awk`, `sed`. > More information: . -- Start ed, editing an empty document (which can be saved as a new file in the current directory): +- Start an interactive editor session with an empty document: `ed` -- Start ed, editing an empty document, with `:` as a command prompt indicator: +- Start an interactive editor session with an empty document and a specific prompt: -`ed -p :` +`ed --prompt='> '` -- Start ed editing an existing file (this shows the byte count of the loaded file): +- Start an interactive editor session with user-friendly errors: -`ed -p : {{path/to/file}}` +`ed --verbose` -- Toggle the printing of error explanations. (By default, explanations are not printed and only a `?` appears): +- Start an interactive editor session with an empty document and without diagnostics, byte counts and '!' prompt: -`H` +`ed --quiet` -- Add text to the current document. Mark completion by entering a period by itself in a new line: +- Start an interactive editor session without exit status change when command fails: -`a{{text_to_insert}}.` +`ed --loose-exit-status` -- Print the entire document (`,` is a shortcut to the range `1,$` which covers the start to the end of the document): +- Edit a specific file (this shows the byte count of the loaded file): -`,p` +`ed {{path/to/file}}` -- Write the current document to a new file (the filename can be omitted if `ed` was called with an existing file): +- Replace a string with a specific replacement for all lines: -`w {{filename}}` - -- Quit ed: - -`q` +`,s/{{regular_expression}}/{{replacement}}/g` diff --git a/pages/osx/ed.md b/pages/osx/ed.md new file mode 100644 index 000000000..b85850abd --- /dev/null +++ b/pages/osx/ed.md @@ -0,0 +1,25 @@ +# ed + +> The original Unix text editor. +> See also: `awk`, `sed`. +> More information: . + +- Start an interactive editor session with an empty document: + +`ed` + +- Start an interactive editor session with an empty document and a specific [p]rompt: + +`ed -p '> '` + +- Start an interactive editor session with an empty document and without diagnostics, byte counts and '!' prompt: + +`ed -s` + +- Edit a specific file (this shows the byte count of the loaded file): + +`ed {{path/to/file}}` + +- Replace a string with a specific replacement for all lines: + +`,s/{{regular_expression}}/{{replacement}}/g`