I have a sample file like this
7829885 7831552 + 1 1667, 0,
35934936 35937087 - 2 1281,870, 0,1281,
I would like to replace values starts with comma with just value like 0, to 0 or 1667, to 1667.
I can do with this by using tr -d '0,' '0' <file
But the problem having here is I would like to replace only single value that has comma like 0, or 1667, not the multiple valuse with commas like 1281,870, or 0,1281,
Briefly with out confusion
I have to remove the commas of all single values (1667 0)
I have to remove the last commas of all multiple values (1281,870 0,1281)
output
7829885 7831552 + 1 1667 0
35934936 35937087 - 2 1281,870 0,1281
Thanx