inserting text into a specific line

前端 未结 3 1532
北海茫月
北海茫月 2021-02-06 00:00

I\'ve got a text file, and using Bash I wish to insert text into into a specific line.

Text to be inserted for example is !comment: http://www.test.com into

3条回答
  •  故里飘歌
    2021-02-06 00:49

    sed '4a\
    !comment: http://www.test.com' file.txt > result.txt
    

    i inserts before the current line, a appends after the line.

提交回复
热议问题