문제

I have a file myFile.xmlwhich I want to run the xmllintcommand on for proper formatting.

It contains the ASCII character 26 (substitute char) because of which xmllint command is failing with parser error.

How can I replace all occurrences of this character with blank in this file?

도움이 되었습니까?

해결책

The following worked:

tr -cd '\11\12\15\40-\176' < file-with-binary-chars > clean-file

referred from here:

ascii-control-characters

다른 팁

If you are using bash, how about this:

sed $'s/\x1a//g' < FILENAME | xmllint

This uses the special bash notation $'...' which tells the bash to evaluate backslash sequences like the \x1a properly.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top