如何删除一组特殊字符(见附件)
这个字符很特殊,我无法输入代码,因为论坛不支持它。下面是它的代码格式: [32;1m
立方体(第一个字符)是文件中向左的箭头(请参阅上面的链接)。 这是角色的外观图片。请参阅文件:http: //www.dodaj.rs/f/2u/ar/3B1Q7J4Q/sample.jpg 这是文件的附件,其中包含我要删除的内容: http:// hotfile.com/dl/124448134/58e08a0/File.log.html 这是完整的文件:
[32;1m/var/log/daemon.log file is rotated1...[0m
[32;1m/var/log/daemon.log file is rotated2...[0m
[37;1m/var/log/daemon.log file is rotated3...[0m
[35;1m/var/log/daemon.log file is rotated3...[0m
[33;1mhello[0m
[33;1mthis is sample[0m
[33;1mwhats up?[0m
我想要的是删除所有不必要的字符并输出为:
/var/log/daemon.log file is rotated1...
/var/log/daemon.log file is rotated2...
/var/log/daemon.log file is rotated3...
/var/log/daemon.log file is rotated3...
hello
this is sample
whats up?
我尝试使用 sed 删除特殊字符,例如:
cat File.log | sed 's/[!@#\$%^&*()]//g' | sed -e 's/37;1m//g' > output.log
但它什么也不做。 有人可以给我写一段代码来满足我的需要吗? 谢谢。
编辑:发布帖子箭头后在论坛上看不到......
This characters is special I can not put in code because the forum not support it. Here is how it looks in code format: [32;1m
The cube (first character) is arrow to left in file (see links above).
Here is the picture of character how it look.See the file: http://www.dodaj.rs/f/2u/ar/3B1Q7J4Q/sample.jpg
And here is attachement of file it consist what I want to remove: http://hotfile.com/dl/124448134/58e08a0/File.log.html
Here is the complete file:
[32;1m/var/log/daemon.log file is rotated1...[0m
[32;1m/var/log/daemon.log file is rotated2...[0m
[37;1m/var/log/daemon.log file is rotated3...[0m
[35;1m/var/log/daemon.log file is rotated3...[0m
[33;1mhello[0m
[33;1mthis is sample[0m
[33;1mwhats up?[0m
What I want is to delete everything of unnecessary characters and output to be:
/var/log/daemon.log file is rotated1...
/var/log/daemon.log file is rotated2...
/var/log/daemon.log file is rotated3...
/var/log/daemon.log file is rotated3...
hello
this is sample
whats up?
I tried to delete special characters with sed like:
cat File.log | sed 's/[!@#\$%^&*()]//g' | sed -e 's/37;1m//g' > output.log
but it do nothing.
Can someone please write me that code that make what I need?
Thx.
EDIT: After posting the post arrow can not see on forum...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
/var/log/daemon.log 文件已轮换1...
/var/log/daemon.log file is rotated1...