I'm trying to write a CSV join program in AWK which joins the first.csv
file with the second.csv
file. The program now works perfectly fine, assuming the the number of rows in both files are the same.
The problem arises when one of the files contains more rows than the other; in this case, I'd have to add multiple number of commas (which depends to the number of fields in input files), to the file with less number of rows, so that the columns are not misplaced.
The question is, How can I create and assign strings containing different number of commas? for instance,
if: NumberOfFields==5
; Then, I want to create string ",,,,,"
and add it to an Array[i].