在平面文件中替换空字符^ @ [英] Replacing the null character ^@ in a flat file
本文介绍了在平面文件中替换空字符^ @的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个从他人软件生成的平面文件.他们在文件的某些位置插入空字符^ @.我希望用-9之类的东西代替它们.如何在Mac OS X的终端中有效搜索和替换此字符?
I have a flat file generated from someone else's software. They insert the null character ^@ in certain positions of the file. I wish to replace them with something else like -9. How do I search and replace this character efficiently in terminal on Mac OS X?
谢谢.
还有另一篇文章针对Linux中的这个问题./p>
There is another post addressing this question in linux.
推荐答案
(要保持SO的传统,即使用不同的工具针对shell脚本问题提出多个答案):
(To maintain a SO tradition of proposing multiple answers with different tools for shell scripting questions):
使用tr
:
tr -d '\0'
这篇关于在平面文件中替换空字符^ @的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文