The following is an example of removing NULL characters using ex (in place):
ex -s +"%s/\%x00//g" -cwq nulls.txt
and for several files:
ex -s +'bufdo!%s/\%x00//g' -cxa *.txt
For recursion, you can use the **/*.txt substitution option (if supported by your shell).
Useful for scripts, as sed and its -i option are non-standard BSD extensions.
See also: How to check if a file is a binary file and read all files that are not?
kenorb May 29 '15 at 23:01 2015-05-29 23:01
source share