I am trying to write awk for a file I have. Example of the dataset is
S,CV0110,1235
S,1234
D,CQ120,3245
P,7894
Desired outcome is as follows (added empty field when the number of fields in a row is 2)
S,CV0110,1235
S,,1234
D,CQ120,3245
P,,7894
I tried this but it is adding value for all data rows instead of those that have 2 fields.
printf 'S,CV010,1235\r\n' | awk 'BEGIN{FS=OFS="fs"}{$n = $n OFS value}1'