You could easily do this tsk in awk. Please try following code written and tested in GNU awk.
awk '
BEGIN{ FS=OFS="," }
NF==3{
match($0,/(^[^,]*),([^,]*),(.*$)/,arr)
print arr[1],arr[2]"."arr[3]
next
}
NF==4{
match($0,/(^[^,]*),([^,]*),([^,]*),(.*)$/,arr)
print arr[1]"."arr[2],arr[3]"."arr[4]
}
' Input_file
NOTE: In case you want to save output into Input_file itself then append > temp && mv temp Input_file to above code.
Explanation: Adding detailed explanation for above awk code.
awk ' ##Starting awk program from here.
BEGIN{ FS=OFS="," } ##Setting FS and OFS as comma in BEGIN section of this awk program.
NF==3{ ##Checking if there are 3 number of fields in current line then do following.
match($0,/(^[^,]*),([^,]*),(.*$)/,arr) ##Using match to match regex (^[^,]*),([^,]*),(.*$) to create 3 capturing group to be saved into arr array.
print arr[1],arr[2]"."arr[3] ##Printing 1st element of arr followed by comma followed by 2nd element followed by DOT followed by 3rd element of arr.
next ##next will skip all further statements from here.
}
NF==4{ ##Checking if there are 4 number of fields in current line then do following.
match($0,/(^[^,]*),([^,]*),([^,]*),(.*)$/,arr) ##Using match to match regex (^[^,]*),([^,]*),([^,]*),(.*)$ to create 4 capturing group to be saved into arr array.
print arr[1]"."arr[2],arr[3]"."arr[4] ##Printing 1st element of arr followed by dot followed by 2nd element followed by comma followed by 3rd element of arr, followed by DOT followed by 4th element of arr.
}
' Input_file ##Mentioning Input_file name here.