I would like to run a find and replace on an HTML file through the command line.
(我想通过命令行在HTML文件上运行查找和替换。)
My command looks something like this:
(我的命令如下所示:)
sed -e s/STRING_TO_REPLACE/STRING_TO_REPLACE_IT/g index.html > index.html
When I run this and look at the file afterward, it is empty.
(当我运行此文件并随后查看文件时,它为空。)
It deleted the contents of my file. (它删除了我文件的内容。)
When I run this after restoring the file again:
(当我再次还原文件后运行此命令时:)
sed -e s/STRING_TO_REPLACE/STRING_TO_REPLACE_IT/g index.html
The stdout
is the contents of the file, and the find and replace has been executed.
(stdout
是文件的内容,并且查找和替换已执行。)
Why is this happening?
(为什么会这样呢?)
ask by BBales translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…