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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to erase a char(,) locates between two "

Status
Not open for further replies.

jarod

Programmer
Aug 10, 2001
6
US
Hi,

Could you please help me to find a solution on how to erase a char (,) locates between two ".

By knowing that a record is like below:
"C00A12",55789,T456,"AUM, QWE TU",44456,AUF


Thanks.
 

Hi jarod!

You can try this program solution (and test it carefuly):


Code:
# delcoma.awk - deletes comma from fiels in csv-file
# delcoma.awk - croatian: brise zarez iz polja csv-datoteke
# Kruno Peter, kruno_peter@yahoo.com
# true awk, Public Domain, August 2001
# Jesus loves you.

{
    split($0,ch,"")
    for (i = 1; i <= length; i ++) {
        if (ch[i] == &quot;\&quot;&quot; && swOpen) {    # close
            swOpen = 0
            newRow = newRow ch[i]
            continue
	}
        if (ch[i] == &quot;\&quot;&quot; && !swOpen) {    # open
            swOpen = 1
            newRow = newRow ch[i]
            continue
	}
	print swOpen, ch[i]
        if (swOpen && ch[i] == &quot;,&quot;) continue
        newRow = newRow ch[i]
    }
    print newRow
}

I hope this helps. :)

Bye!

KP.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top