I am looking for a sed
command to match pattern and copy pattern line and n
number of lines after this line.
pattern is 01
, 02
, 03
sequence.
Example:
group-title=01- line1
http://www.yahoo.com
group-title=02- local3
http://www.altavista.com
group-title=01- koko1
http://www.bbc.com
Required output:
group-title=01- line1
http://www.yahoo.com
group-title=01- koko1
http://www.bbc.com
I tried
sed -n "/01- /p" orignal.txt > copyof.txt
but this only copy line which matches pattern. I have to copy the 2nd line also as second line has its link.