Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove unwanted character from within field

Status
Not open for further replies.

confuseddddd

Programmer
May 22, 2003
53
US
Have a file that uses * as its field separator. Within in the file, there are is a certain type of record that is containing * where it should not be, (within a specific field).

I wanted to write a script that would read in the file and edit out the * from the field where it should not be...

Here is some examples of the "bad" records:
CLM*1065WC*12755*173.00*WC**11^^1******EM^^^TXLM*1065WC*12755*173.00*WC**11^^1******EM^^^TX
(remove asterick between 1065WC and 12755, leave the other astericks)

CLM*829495*1*6*2430.00*WC**22^^1******EM^^^TX
(remove astericks between 829495 and 1 and 6, leave the other astericks) CLM*829495*1*6*2430.00*WC**22^^1******EM^^^TX

Here are some examples of the "good" records:
CLM*G3I261193*111.00*WC**11^^1******EM^^^TX
CLM*NA*26.70*WC**12^^1******EM^^^TX

I was hoping to find the CLM* record, then find within the CLM* record, the amount field with the leading * and then what is between those 2 fields, to check if there is another asterick(s). If there is, to remove the asterick(s).

Anyone have any ideas on how to accomplish this???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top