sed: insert a string after every N lines

前端 未结 6 2043
無奈伤痛
無奈伤痛 2021-01-31 03:55

I want to insert a string after every 30 lines in my large file. I\'m using mini-sed, which doesn\'t support ~ (tilde) range operator. I\'m looking for sed-only solution please.

6条回答
  •  迷失自我
    2021-01-31 04:27

    sed 'n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;s/$/\ 
    string/' filename
    

提交回复
热议问题