Help trying to understand sed -need just the line number of a line with specfic text.

classic Classic list List threaded Threaded
2 messages Options
MJ
Reply | Threaded
Open this post in threaded view
|

Help trying to understand sed -need just the line number of a line with specfic text.

MJ
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Help trying to understand sed -need just the line number of a line with specfic text.

Guru
Administrator
To insert a line say "welcome" before the line containing the pattern "def":

$ cat a
abc
def
ghi
$
$ sed '/def/i welcome' a
abc
welcome
def
ghi
$