in reply to text file validation

on *nix there is nothing extra needed (wc -c filename), whereas on Windows you could do something like:
perl -e '$/=undef(); $_ = <>; print length($_)."\n";' < filename
er, scratch that, you don't really want to count anything after all, but just find the substring as already suggested.

-M

Free your mind