sed, replace first line

后端 未结 2 1128
灰色年华
灰色年华 2021-02-02 06:06

I got hacked by running a really outdated Drupal installation (shame on me)

It seems they injected the following in every .php file;



        
2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-02 06:42

    You can use sed with something like

    sed '1 s/^.*$/

    The 1 part only replaces the first line. Then, thanks to the s command, it replaces the whole line by .

    To modify your files in-place, use the -i option of GNU sed.

提交回复
热议问题