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

前端 未结 5 1694
南笙
南笙 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:10

    And what's wrong with the easy solution?:

    $data=`cat /the/input/file`;
    $data=~s/some_1 {\n/some_1 {\nAPPLY DELAYS xx\nAPPLY LOADS ld\n/gm;
    print $data;
    

提交回复
热议问题