From the sed manpage:
-i extension
Edit files in-place, saving backups with the specified extension.
If a zero-length extension is given, no backup will be saved. It
is not recommended to give a zero-length extension when in-place
editing files, as you risk corruption or partial content in situ-
ations where disk space is exhausted, etc.
Aha, it wants to save a backup file. So I changed my command to:
sed -i '.bak' 's/apples/oranges/' file.txt
The solution is to send a zero-length extension like this:
sed -i '' 's/apples/oranges/' file.txt
打赏
如果这篇文章解决了您的问题,让我买根烟抽抽。
支付宝.jpg 微信.jpg
网友评论