dimanche 12 avril 2020

Find a matching text and replace next two lines in unix

I have a file like this

  • aaa
  • bbb
  • ccc
  • ddd
  • eee

I want to find bbb and replace next 2 lines with zzz. The final outcome should be

  • aaa
  • bbb
  • zzz
  • zzz
  • eee

I tried sed, I can do for one line. Not sure how to do it for 2 lines. Please help. Thanks in advance

Aucun commentaire:

Enregistrer un commentaire