From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 From: dexen deVries Date: Fri, 26 May 2017 16:20:50 +0200 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset="UTF-8" Subject: [9fans] Acme Edit to remove lines Topicbox-Message-UUID: be7d07a8-ead9-11e9-9d60-3106f5b1d025 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. From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 References: In-Reply-To: From: Paul Lalonde Date: Fri, 26 May 2017 14:27:07 +0000 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary="94eb2c191e047d460805506e22fc" Subject: Re: [9fans] Acme Edit to remove lines Topicbox-Message-UUID: be81683e-ead9-11e9-9d60-3106f5b1d025 --94eb2c191e047d460805506e22fc Content-Type: text/plain; charset="UTF-8" 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 starting with one particular character; without > leaving an empty line behind, thus Edit s/X.+//d is not sufficient. > > --94eb2c191e047d460805506e22fc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 <de= xen.devries@gmail.com> wrote:
Date: Fri, 26 May 2017 14:29:37 +0000 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary="001a114b469a6468b105506e2b4c" Subject: Re: [9fans] Acme Edit to remove lines Topicbox-Message-UUID: be859508-ead9-11e9-9d60-3106f5b1d025 --001a114b469a6468b105506e2b4c Content-Type: text/plain; charset="UTF-8" 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 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. > > --001a114b469a6468b105506e2b4c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
You ought to be able to just add '\n' to the end o= f your expression in an 'x//' + 'd'=C2=A0command sequence.<= div>For example, "search the file for lines starting with [a-z] and de= lete the entire line" would be:

Edit ,x/^[= a-z].+\n/d

On Fri, May 26, 2017 at 7:23 AM dexen deVries <dexen.devries@gmail.com> wrote:
given multi-line dot, spanning only part o= f 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.

--001a114b469a6468b105506e2b4c-- From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: From: dexen deVries Date: Fri, 26 May 2017 17:07:13 +0200 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset="UTF-8" Subject: Re: [9fans] Acme Edit to remove lines Topicbox-Message-UUID: be897bdc-ead9-11e9-9d60-3106f5b1d025 thanks, that did the trick indeed. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Micah Stetson Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Date: Fri, 26 May 2017 09:33:12 -0700 Message-Id: References: In-Reply-To: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Subject: Re: [9fans] Acme Edit to remove lines Topicbox-Message-UUID: be8d7f52-ead9-11e9-9d60-3106f5b1d025 You can also take advantage of x's default behavior of splitting the selecti= on into lines and use g to select which you want: Edit x g/^X/d