By a sentence in a text I mean a string that may span several lines; its beginning is the beginning of a line, or a period (.) followed by a space, and it is ended by a period followed by at least one space or newline.
What is a good way in ed to delete a sentence, which may span several lines?
When editing prose in
ed
, I prefer to keep one sentence per line to simplify this. That said, if your sentences flow over multiple lines, it's usually a three-step process to delete them: delete the head of the sentence, delete the tail of the sentence, and the lines in between. Thus you might do something like (using the opening paragraph from Fahrenheit 451 as an example)optionally issuing
to join the following text to the previous text.
If you keep one sentence per line, it's as simple as
10d
to delete the line in question. This also has the benefits that version control diffs give more helpful output, showing added/removed sentences.