Perl - Insert lines after a match is found in a file

前端 未结 5 1686
南笙
南笙 2021-01-24 09:34

I have a file with the following syntax in some_1.xyz

module some_1 {
INPUT PINS
OUTPUT PINS
}

and I want to insert APPLY DELAYS xx and APPLY L

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-24 10:16

    one-liner

    perl -pi -e '/module some_1/ and $_.="APPLY DELAY xx \nAPPLY LOADS  ld\n"' files*.txt
    

提交回复
热议问题