in reply to How to validate file format

Apologies to Tom Cruise, but: SHOW ME THE CODE! Show what you've already tried. Explain what output you're getting and how it differs from what you expect.