9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Acme Edit to remove lines
@ 2017-05-26 14:20 dexen deVries
  2017-05-26 14:27 ` Paul Lalonde
  2017-05-26 14:29 ` James A. Robinson
  0 siblings, 2 replies; 5+ messages in thread
From: dexen deVries @ 2017-05-26 14:20 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] Acme Edit to remove lines
  2017-05-26 14:20 [9fans] Acme Edit to remove lines dexen deVries
@ 2017-05-26 14:27 ` Paul Lalonde
  2017-05-26 14:29 ` James A. Robinson
  1 sibling, 0 replies; 5+ messages in thread
From: Paul Lalonde @ 2017-05-26 14:27 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 459 bytes --]

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 <dexen.devries@gmail.com>
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.
>
>

[-- Attachment #2: Type: text/html, Size: 699 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] Acme Edit to remove lines
  2017-05-26 14:20 [9fans] Acme Edit to remove lines dexen deVries
  2017-05-26 14:27 ` Paul Lalonde
@ 2017-05-26 14:29 ` James A. Robinson
  2017-05-26 15:07   ` dexen deVries
  1 sibling, 1 reply; 5+ messages in thread
From: James A. Robinson @ 2017-05-26 14:29 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 615 bytes --]

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 <dexen.devries@gmail.com>
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.
>
>

[-- Attachment #2: Type: text/html, Size: 949 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] Acme Edit to remove lines
  2017-05-26 14:29 ` James A. Robinson
@ 2017-05-26 15:07   ` dexen deVries
  2017-05-26 16:33     ` Micah Stetson
  0 siblings, 1 reply; 5+ messages in thread
From: dexen deVries @ 2017-05-26 15:07 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

thanks, that did the trick indeed.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] Acme Edit to remove lines
  2017-05-26 15:07   ` dexen deVries
@ 2017-05-26 16:33     ` Micah Stetson
  0 siblings, 0 replies; 5+ messages in thread
From: Micah Stetson @ 2017-05-26 16:33 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-05-26 16:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-26 14:20 [9fans] Acme Edit to remove lines dexen deVries
2017-05-26 14:27 ` Paul Lalonde
2017-05-26 14:29 ` James A. Robinson
2017-05-26 15:07   ` dexen deVries
2017-05-26 16:33     ` Micah Stetson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).