How to remove special character  character in a file in unix?

问题描述 投票:0回答:1

以下是我文件中的数据:

one_1.10=to - Standard (£1.10)
ITV_1.10=to - Standard (£1.10)

我想在我的 unix 文件中删除 Â?

我尝试了以下方法。在 vi 模式下打开文件并给出以下命令

:set nobomb
:wq

sed -i '1 s/^\xef\xbb\xbf//' <fileName>

但是 BOM 字符没有被删除。有人可以帮忙吗?

shell unix byte-order-mark
1个回答
0
投票

尝试:

cat <filename> | sed 's/\xc2//g'

你的想法是正确的,但角色是错误的(根据你的例子)。

© www.soinside.com 2019 - 2024. All rights reserved.