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 @   小鲨鱼2018  阅读(355)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
历史上的今天:
2022-01-01 linux系统中如何精确匹配0
2022-01-01 ubuntu 编译报错 configure: error: You need zlib >= 1.2.3 to build bin/PopLDdecay
2022-01-01 Err:12 http://security.ubuntu.com/ubuntu focal-updates/main amd64 openjdk-11-jre-headless amd64 11.0.11+9-0ubuntu2~20.04 404 Not Found [IP: 91.189.88.152 80]
2021-01-01 python中删除字典的键值对
2021-01-01 python中清空字典
2021-01-01 python中由列表生成字典
2021-01-01 python中zip同时循环两个可迭代对象
点击右上角即可分享
微信分享提示