Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个文件myFile.xml,我想在其上运行xmllint命令以进行正确格式化。
myFile.xml
xmllint
它包含 ASCII 字符 26(替代字符),因为该xmllint命令因解析器错误而失败。
如何在这个文件中用空白替换所有出现的这个字符?
以下工作:
tr -cd '\11\12\15\40-\176' < file-with-binary-chars > clean-file
从这里提到:
ascii 控制字符
如果您正在使用bash,这个怎么样:
bash
sed $'s/\x1a//g' < FILENAME | xmllint
这使用了特殊的bash符号$'...',它告诉像正确地 bash评估反斜杠序列。\x1a
$'...'
\x1a