function flush(){ if(ent!="" && t!="") printf "%.0f\t%.0f\t%s\t%s\n", x, y, ent, t; ent=""; t=""; x=0; y=0 } NR%2==1{c=$0; gsub(/ /,"",c); next} {v=$0 if(c=="0"){ flush(); if(v=="TEXT"||v=="MTEXT"||v=="ATTRIB") ent=v; next } if(ent=="") next if(c=="10") x=v; else if(c=="20") y=v; else if(c=="1") t=v; else if(c=="3") t=t v } END{flush()}