diff --git a/pages/common/ed.md b/pages/common/ed.md index ec2bacc2b4..dc54074e8d 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 0000000000..b85850abd9 --- /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`