Try to make the records shorter. You said that the <abc></abc> tags come in the last portion around after 500000 line so the first record is really long

. You can make it shorter including other tags/strings (that you have at the beginig of the file) in the RS: for example RS="<abc>|<other_tag>". Or, if you prefer, you can send me a zipped copy of your file privately, so I could give a try

BTW, what's your Awk version?