i need a sample unix awk/sed program to replace param3 in a file.
i have sample file a.dat with the following format/length (week 8, sku 20, store 20 and qty 8). all store id's which end with _2 needs to be replaced with div id 2. all store id's which end with _1 needs to be replaced with div id 1.
W23_2009275 999_2 8.991052
W24_2009275 999_2 8.991052
W25_2009275 97_2 8.991052
W26_2009275 96_2 8.991052
W51_2008102 99_1 2.851916
W52_2008102 96_1 2.851916
W51_2008104 96_1 5.468747
W52_2008104 999_1 5.468747
new file b.dat should look like this
W23_2009275 2 8.991052
W24_2009275 2 8.991052
W25_2009275 2 8.991052
W26_2009275 2 8.991052
W51_2008102 1 2.851916
W52_2008102 1 2.851916
W51_2008104 1 5.468747
W52_2008104 1 5.468747