INPUT
New,9,1
Old,11,0
OUTPUT
New,09,1
Old,11,0
I would like to append to filed number 2 after first ,
in case if it's single digit so i would like to add 0
before the digit as the output shown.
I were able to achieve that using awk
but i lost ,
as separator.
using the following command
awk -F ',' '{if(length($2)==1)$2="0"$2;print $0}' inputfile
awk -F ',' 'BEGIN { OFS=","};{if(length($2)==1)$2="0"$2;print $0}'
Using OFS will ensure that the commas are printed