Did you try throwing in some binmodes for all the input and output files? It's easy to forget.
In reply to Re: binary search/replace by ambrus in thread binary search/replace by momo33