fix endianness problem.
further optimize awk by not looking for the BEGIN regex until we found the
BEGIN (Jan Kaluza)