[英]Using sed to replace tab with spaces
I'm trying to replace the tab with 4 spaces, using sed, but it is not working.我正在尝试使用 sed 用 4 个空格替换选项卡,但它不起作用。
Here is my code:这是我的代码:
sed -i '{s/\t/ \{4\}/g}' filename
Any suggestion is appreciate.任何建议表示赞赏。
In sed
replacement is not supposed to be a regex, so use:在
sed
替换中不应该是正则表达式,所以使用:
sed -i.bak $'s/\t/ /g' filename
On gnu-sed even this will work:在 gnu-sed 上,即使这样也可以工作:
sed -i.bak 's/\t/ /g' filename
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.