How can I display and remove all chars > ascii code 127 from a file?
UPDATE Dennis has solved it but there is some interesting discussion about number ranges.
I have a regex for it and this is some commentary on how I worked it out, with a few tests.
0080-00FF 00[89A-F][0-9A-F]
0100-0FFF 0[1-9A-F][0-9A-F]{2}
1000-FFFF [1-9A-F][0-9A-F]{3}
And the tests-
$ xxd -u -p a.aa.txt | sed -r "s/.{4}/\0 /g" | grep -oE "[0-9A-F]{4}" | wc -l
85
$ xxd -u -p a.aa.txt | sed -r "s/.{4}/\0 /g" | grep -oE "00[0-7][0-F]" | wc -
l
72
$ xxd -p -u a.aa.txt | sed -r "s/[0-9A-F]{4}/\0 /g" | grep -oP '((?!00[0-7][0-9A-F])(?=[^ ]).){4}' | wc -l
13
$ xxd -u -p a.aa.txt | sed -r "s/.{4}/\0 /g" | grep -oE "00[89A-F][0-9A-F]|0[1-9A-F][0-9A-F]{2}|[1-9A-F][0-9A-F]{3}" | wc –l
13
I know sed doesn't have negative lookahead, but we have the positive version. And also it helped a bit as a test.
