I have file which looks like this
ISA*00* *00* *ZZ*245391167 *ZZ*645529160 *040107*134
9*U*00200*213356538*0*P*>^M
GS*HN*245391167*645529160*20040107*1349*356539*X*0
03050^M
NM1*QC*1*WEST*TARSHA****MR*501633110^M
TRN*1*T2200401070000081P000000^M
STC*PR001***000000012000^M
REF*EJ*001515009206^M
REF*1K*200020030200400773057088*000000000000000000
000000 SPLIT^M
DTP*150*D8*20031013^M
STC*PR001^M
REF*55*01^M
SE*17*356539001^M
GE*1*356539^M
IEA*1*213356538^M
i want to take out the name without any astriks which in NM1 line
take out PR001 from STC line
and take out numbers after EJ on first REF line
can some one help me?