Sorry for not being clear. It is not the number of fields that matters in each line. I added the line numbers below so that they can be easily referred. They are not part of the file content.
There are basically two formats. One format contains the user's last/first names and UID, e.g. lines 1, 2, 3 and 6. The second format contains only the UID (that is useful), e.g. lines 4 and 5. The second format appears when the user in the above line has more than one UID's in the system. So in the result of the script, I want that user name repeated with additional UID's rather than being omitted (as in the original file). Does this make sense?
I also did not make it clear that in the lines in the second format, the UID's always appear in the same field, $4, e.g. lines 4 and 5. So I want to repeat $8 and $12 from the directly above line (line 3), and print $4 for lines 4 and 5.
If saying $4 is a number is not ideal, $5 in the second format always contains the exact same string, blah in this case in lines 4 and 5.
1 "pippo","is fat","last","Cruise","first","Tom","UID","1234","is 50 years old"
2 "monky","looks funky","last","Jones","first","Catherine Zeta","UID","2345","is still hot"
3 "lion","rules savannah","last","Baldwin","first","Alec","UID","3456","his brother sued costner and lost"
4 "taco","4567","blah","age of rock"
5 "chili","5678","blah","flopped bit time"
6 "mojito","tastes awesome","last","Brand","first","Russell","UID","6789","didn't deserve katy"