I would like to replace the last column values with another value using vim editor or sed command.I tried the below command but it replaces the data which is already present in my 2nd column sometimes.
:%s/,3/,2/
My sample data:
410339,166,1430,3
410340,112,1840,3
410341,109,1315,3
410342,123,1435,3
410343,230,3200,3
410344,857,36975,3
410345,125,4440,3
410346,105,1460,3
410348,122,1150,3
410349,314,2380,3
410350,132,4650,3
410351,136,7465,3
410352,103,1775,3
410353,101,1095,3
410354,101,1360,3
To complete your attempt in Vim, just anchor the matched expression to the end of the line with
$.Produces: