Help in locating a word in huge files

hi

i receive about 5000 files per day in my system. Each of them are like:

cat ABC.april24.dat
ABH00001990 01993 409009092 0909 INI iop 9033
AAB0000237893784 8430900 898383 AUS 34349089008 849843 9474822
AAA00003849893498098394 84834 348348439 -438939 IN
AAA00004438493893849384 89809 978980980 -898988 IND
.
.
.

each of these files have millions of line like this, and Each line has fix format depending upon category (ABH, AAB,AAA), i want to find all AAA category in the file which have IN any where in location 54-60, as this is invalid value and IND is correct. So like this i want to identiy all AAA lines which has invalid value 'IN' instead of 'IND'.

finding it difficult due to huge size of these files

Thanks in advance !!!

Not shure what output you desire but you could do something like:

awk '/^AAA/ && $NF=="IN$"{print "File: "FILENAME: ", line "FNR}' files...

If the lines begin with "AAA" and end with "IN" followed by optional spaces:

$ sed -n '/^AAA.*IN *$/p' ABC.april24.dat 
AAA00003849893498098394 84834 348348439 -438939 IN

Regards,
Alister