Hi - I have a file "file1" of below format. Its a comma seperated file. Note that each string is enclosed in double quotes.
"abc","-0.15","10,000.00","IJK"
"xyz","1,000.01","1,000,000.50","OPR"
I want the result as:
"abc","-0.15","10000.00","IJK"
"xyz","1,000.01","1000000.50","OPR"
I want to remove all the comma in the numeric string value of the 3rd column of all rows in the file file1.
I tried the below command.
awk ' BEGIN { FS = "\",\"" } ; { gsub(/,/, "", $42) }1' file1
Output is:
"abc -0.15 10000.00 IJK"
"xyz 1,000.01 1000000.50 OPR"
I used "," as field seperator. It correctly removed the commas in the 3rd column values, but it also replaced the "," with a space.
Request help in resolving this. Appreciate your help.
Thanks!
[/FONT][/COLOR]