Saturday, 26 January 2019

how to delete comma inside double quotes in a file in unix


wrong line

101,1033,"123,888.00"

output should be like this

101,1033,123888.00


use the following command

awk -F'"' -v OFS='' '{ for (i=2; i<=NF; i+=2) gsub(",", "", $i) } 1'  input_file >outputfile.txt

here input_file is the file which has the above dataset.
outputfile is the file which will created in your system once you executed the above command.



Thanks,
Saisma









No comments:

Post a Comment