find matching text and replace next line

前端 未结 3 1526
北恋
北恋 2020-12-02 22:01

I\'m trying to find a line in a file and replace the next line with a specific value. I tried sed, but it seems to not like the \\n. How else can this be done?

The f

3条回答
  •  猫巷女王i
    2020-12-02 22:49

    It works. Additionaly is interested to mention that if you write,

    sed '/ConnectionString<\/key>/!b;n;n;cchanged_value' file
    

    Note the two n's, it replaces after two lines and so forth.

提交回复
热议问题