How to remove comma?

hi all,

in the 3rd field i am having comma.

can anyone tell me how to remove the comma in the 3rd field and 4th field.

|1.77|0.1|1,335.20|3,513.30|190|7.00 |4.40 |2.50 |1|1|5|5|Section903-Liquor|StLouis|0|||||||||||
40997|9999999|9999999|195186280|0102796|36949|00083089660358|2016|MAY

---------- Post updated at 02:02 AM ---------- Previous update was at 01:47 AM ----------

i have removed the comma by using the below command.

sed 's/,//g' filename > new filename

Rigt now i dont know how to remove the spaces only in the 3rd field and 4th field.
any idea what is the command to remove the space in 3rd and 4th field

1.77|0.1|1335.20 |3513.30 |190|7.00 |4.40 |2.50 |1|1|5|5|Section903-Liquor|StLouis|0||||||||||

Hello arun888,

Considering that |1.77 into your first line of Input_file is a typo as I can't see that in your shown output. So following may help you in same.

awk -F"|" '{gsub(/,/,X,$4);gsub(/,/,X,$3);print}' OFS="|"  Input_file

Thanks,
R. Singh

1 Like

thanks ravinder the command you gave it is worked.

I have used this command for other request.

Thanks for your help again