Code:
#!/bin/awk -f
NR!=1 {while(substr($0,1,2)!="GA")
{gsub(/\|/,"-",$0); if(substr($0,1,1)=="H"&&substr($0,343,39)!="RUA DR. EDUARDO SANTOS SILVA 261 - FRAC"){print substr($0,1,11)"|" substr($0,12,12)"|" substr($0,24,4)"|" substr($0,28,3)"|" substr($0,31,40)"|" substr($0,71,14)"|" substr($0,85,2)"|" substr($0,87,4)"|" substr($0,91,10)"|" substr($0,101,46)"|" substr($0,147,35)"|" substr($0,182,8)"|" substr($0,190,2)"|" substr($0,192,2)"|" substr($0,194,1)"|" substr($0,195,2)"|" substr($0,197,2)"|" substr($0,199,2)"|" substr($0,201,2)"|" substr($0,203,2)"|" substr($0,205,8)"|" substr($0,213,16)"|" substr($0,229,3)"|" substr($0,232,3)"|" substr($0,235,2)"|" substr($0,237,2)"|" substr($0,239,2)"|" substr($0,241,8)"|" substr($0,249,2)"|" substr($0,251,12)"|" substr($0,263,40)"|" substr($0,303,40)"|" substr($0,343,40)"|" substr($0,383,40)"|" substr($0,423,40)"|" substr($0,463,40)"|" substr($0,503,40)"|" substr($0,543,40)"|" substr($0,583,40)"|" substr($0,623,40)"|" substr($0,663,40)"|" substr($0,703,40)"|" substr($0,743,40)"|" substr($0,783,40)"|" substr($0,823,40)"|" substr($0,863,5)"|" substr($0,868,1)"|" substr($0,869,1)"|" substr($0,870,2)"|" substr($0,872,32)"|" substr($0,904,16)"|" substr($0,920,16)"|" substr($0,936,2)"|" substr($0,938,2)"|" substr($0,940,2)"|" substr($0,942,12)"|" substr($0,954,4)"|" substr($0,958,8)"|" substr($0,966,2)"|" substr($0,968,6)"|" substr($0,974,3)"|" substr($0,977,10)"|" substr($0,987,4)"|" substr($0,991,10)"|" substr($0,1001,2)"|" substr($0,1003,4)"|" substr($0,1007,40)"|" substr($0,1047,24)"|" substr($0,1071,24)"|" substr($0,1095,24)"|" substr($0,1119,1)"|" substr($0,1120,14)"|" substr($0,1134,2)"|" substr($0,1136,4)"|" substr($0,1140,16)"|" substr($0,1156,14)"|" substr($0,1170,1)"|" substr($0,1171,8)"|" substr($0,1179,8)"|" substr($0,1187,9)"|" substr($0,1196,20);next}
else if(substr($0,1,1)=="H"&&substr($0,343,39)=="RUA DR. EDUARDO SANTOS SILVA 261 - FRAC"){print substr($0,1,11)"|" substr($0,12,12)"|" substr($0,24,4)"|"substr($0,28,3)"|" substr($0,31,40)"|" substr($0,71,14)"|" substr($0,85,2)"|" substr($0,87,4)"|" substr($0,91,10)"|" substr($0,101,46)"|" substr($0,147,35)"|" substr($0,182,8)"|" substr($0,190,2)"|" substr($0,192,2)"|" substr($0,194,1)"|" substr($0,195,2)"|" substr($0,197,2)"|" substr($0,199,2)"|" substr($0,201,2)"|" substr($0,203,2)"|" substr($0,205,8)"|" substr($0,213,16)"|" substr($0,229,3)"|" substr($0,232,3)"|" substr($0,235,2)"|" substr($0,237,2)"|" substr($0,239,2)"|" substr($0,241,8)"|" substr($0,249,2)"|" substr($0,251,12)"|" substr($0,263,40)"|" substr($0,303,40)"|" substr($0,343,39)"?|" substr($0,383,40)"|" substr($0,423,40)"|" substr($0,463,40)"|" substr($0,503,40)"|" substr($0,543,40)"|" substr($0,583,40)"|" substr($0,623,40)"|" substr($0,663,40)"|" substr($0,703,40)"|" substr($0,743,40)"|" substr($0,783,40)"|" substr($0,823,40)"|" substr($0,863,5)"|" substr($0,868,1)"|" substr($0,869,1)"|" substr($0,870,2)"|" substr($0,872,32)"|" substr($0,904,16)"|" substr($0,920,16)"|" substr($0,936,2)"|" substr($0,938,2)"|" substr($0,940,2)"|" substr($0,942,12)"|" substr($0,954,4)"|" substr($0,958,8)"|" substr($0,966,2)"|" substr($0,968,6)"|" substr($0,974,3)"|" substr($0,977,10)"|" substr($0,987,4)"|" substr($0,991,10)"|" substr($0,1001,2)"|" substr($0,1003,4)"|" substr($0,1007,40)"|" substr($0,1047,24)"|" substr($0,1071,24)"|" substr($0,1095,24)"|" substr($0,1119,1)"|" substr($0,1120,14)"|" substr($0,1134,2)"|" substr($0,1136,4)"|" substr($0,1140,16)"|" substr($0,1156,14)"|" substr($0,1170,1)"|" substr($0,1171,8)"|" substr($0,1179,8)"|" substr($0,1187,9)"|" substr($0,1196,20);next}
else if(substr($0,1,1)=="C"){print substr($0,1,13);next}
else if(substr($0,1,1)=="P"){print substr($0,1,13)"|" substr($0,14,4)"|" substr($0,18,2)"|" substr($0,20,8)"|" substr($0,28,6)"|" substr($0,34,14)"|" substr($0,48,10)"|"substr($0,58,10);next}
else if(substr($0,1,1)=="D"){print substr($0,1,13)"|" substr($0,14,4)"|" substr($0,18,4)"|" substr($0,22,2)"|" substr($0,24,20)"|" substr($0,44,6)"|" substr($0,50,60)"|" substr($0,110,8)"|" substr($0,118,8)"|" substr($0,126,8)"|" substr($0,134,8)"|" substr($0,142,4)"|" substr($0,146,2)"|" substr($0,148,4)"|" substr($0,152,4)"|" substr($0,156,4)"|" substr($0,160,3)"|" substr($0,163,2)"|" substr($0,165,8)"|" substr($0,173,1)"|" substr($0,174,1)"|" substr($0,175,1)"|" substr($0,176,4)"|" substr($0,180,2)"|" substr($0,182,15)"|" substr($0,197,1)"|" substr($0,198,8)"|" substr($0,206,8)"|" substr($0,214,1)"|" substr($0,215,14)"|" substr($0,229,1)"|" substr($0,230,14)"|" substr($0,244,3)"|" substr($0,247,35)"|" substr($0,282,2)"|" substr($0,284,6)"|" substr($0,290,4)"|" substr($0,294,6)"|" substr($0,300,10);next}
else if(substr($0,1,1)=="A"){print substr($0,1,13)"|" substr($0,14,4)"|" substr($0,18,4)"|" substr($0,22,8)"|" substr($0,30,2)"|" substr($0,32,8)"|" substr($0,40,8)"|" substr($0,48,4)"|" substr($0,52,8);next} else if(substr($0,1,1)=="S"){print substr($0,1,13)"|" substr($0,14,2)"|" substr($0,16,8)"|" substr($0,24,8)"|" substr($0,32,10)"|" substr($0,42,10)"|" substr($0,52,14)"|" substr($0,66,8)"|" substr($0,74,10)"|" substr($0,84,8)"|" substr($0,92,4)"|" substr($0,96,4)"|" substr($0,100,1)"|" substr($0,101,18)"|" substr($0,119,8);next}
else if(substr($0,1,1)=="B"||substr($0,1,1)=="I"){print substr($0,1,11)"|" substr($0,12,6)"|" substr($0,18,6)"|" substr($0,24,12)"|" substr($0,36,4)"|" substr($0,40,13)"|" substr($0,53,10)"|" substr($0,63,8)"|" substr($0,71,15)"|" substr($0,86,13)"|" substr($0,99,10);next}}}
END{if(substr($0,1,2)=="GA"){close($testfile)}}