in reply to filling up rows in files to make them of equal length

Do a wc -l * to find out the longest file length, then use that to fill your files with dummy data. Pseudo code:

loop thru all files open file append dummy data to end of file close file end