given multi-line dot, spanning only part of a file, how do i construct
an Edit command to remove lines matching certain regular expression?
wanted to delete lines starting with one particular character; without
leaving an empty line behind, thus Edit s/X.+//d is not sufficient.
x/^X.*\n/d
Or
x/^X/+-d
Away from a terminal so probably subtly wrong.
On Fri, May 26, 2017 at 7:23 AM dexen deVries
wrote:
> given multi-line dot, spanning only part of a file, how do i construct
> an Edit command to remove lines matching certain regular expression?
>
> wanted to delete lines st
You ought to be able to just add '\n' to the end of your expression in an
'x//' + 'd' command sequence.
For example, "search the file for lines starting with [a-z] and delete the
entire line" would be:
Edit ,x/^[a-z].+\n/d
On Fri, May 26, 2017 at 7:23 AM dexen deVries
wrote:
> given multi-line
thanks, that did the trick indeed.
You can also take advantage of x's default behavior of splitting the selection
into lines and use g to select which you want:
Edit x g/^X/d