1

if 3,5p prints lines 3, 4, and 5, how would one print, say, lines 4 AND 7, but not 5 and 6?

Have tried:

3 5 p prints line 8

3p5p breaks as well

jellies
  • 639
  • 1
  • 5
  • 17

1 Answers1

4

ed doesn't generally let you manipulate disjoint lines like this so you'd normally just do

4p
this is line 4
7p
this is line 7

However, ed does allow for a command-list within the context of a g// command, so if you really do need all the output in one response, you can hack it with

1g/^/4p\
7p
this is line 4
this is line 7

It's ugly, it's a hack, and it's inconvenient to type. But if you really do need all the output in one pass, this will do it.

Gumnos
  • 403
  • 3
  • 7