inserting text into a specific line

前端 未结 3 1525
北海茫月
北海茫月 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:52

    you can use awk as well

    $ awk 'NR==5{$0="!comment: http://www.test.com\n"$0}1' file
    !aaaa
    !bbbb
    !cccc
    !ffffdd
    !comment: http://www.test.com
    !eeee
    !ffff
    

提交回复
热议问题