linux 中特殊字符 M-BM-的处理

 

001、

[root@PC1 test]# ls
test.txt
[root@PC1 test]# cat test.txt                    ## 测试数据
Abpink
Jnzoar
Bizxar 
Abcd
[root@PC1 test]# cat -A test.txt                 ## 第三行出现特殊字符B-BM-
Abpink$
Jnzoar$
BizxarM-BM- $
Abcd$

 

 

002、删除特殊字符M-BM-

[root@PC1 test]# ls
test.txt
[root@PC1 test]# cat -A test.txt
Abpink$
Jnzoar$
BizxarM-BM- $
Abcd$
[root@PC1 test]# sed 's/\xc2\xa0/ /g' test.txt | cat -A        ## 产出特殊字符M-BM-,还多出空格
Abpink$
Jnzoar$
Bizxar $
Abcd$
[root@PC1 test]# sed 's/\xc2\xa0/ /g' test.txt | sed 's/ $//g' | cat -A      ## 删除空格
Abpink$
Jnzoar$
Bizxar$
Abcd$

 

posted @ 2023-01-01 17:22  小鲨鱼2018  阅读(252)  评论(0编辑  收藏  举报