Re: Problem with g command in ed

2015-05-16 Thread Andreas Kusalananda Kähäri
On Sat, May 16, 2015 at 07:49:53PM +, hru...@gmail.com wrote:
 Dear Sirs!
 
 I am having a problem with the above command. I am using an older
 version of OpenBSD, but perhaps the problem is also in newer versions.
 
 Experiment:
 
 (1) Write a file with 5 lines, each containg only the character a.
 
 (2) apply the following two lines command:
 
 g/a/\
 d
 
 
 
 Does it do, what one expects?

The command that you give is, according to the manual, equivalent to

g/a/p\
d

(since A newline alone in command-list is equivalent to a p command).

So, it prints all lines matching /a/ and then deletes them.

Cheers,

-- 
:: Andreas Kusalananda Kähäri, Bioinformatics Developer, BILS,
:: Uppsala University, Sweden
::--



Problem with g command in ed

2015-05-16 Thread hruodr
Dear Sirs!

I am having a problem with the above command. I am using an older
version of OpenBSD, but perhaps the problem is also in newer versions.

Experiment:

(1) Write a file with 5 lines, each containg only the character a.

(2) apply the following two lines command:

g/a/\
d



Does it do, what one expects?

Thanks
Rodrigo.



Re: Problem with g command in ed

2015-05-16 Thread hruodr
Andreas Kusalananda Kähäri andreas.kah...@icm.uu.se wrote:

  g/a/\
  d

 The command that you give is, according to the manual, equivalent to

 g/a/p\
 d

 (since A newline alone in command-list is equivalent to a p command).

 So, it prints all lines matching /a/ and then deletes them.

I expect print and delete of each matching line. OpenBSD4.8 ed does not
do it, it behaves strange. Was the problem perhaps fixed later?

Rodrigo.