There are several ways to do this, the best choice depends on the database engine you are using and / or what other tools are available.
The dirtiest method may be to write 64 different sql statements that retrieve data in each of the 64 possible combinations (including where all fields are filled and all fields are filled 6). However, this may not be pleasant,
So the problem is finding a simple, repeatable algorithm to reduce the problem space to something simpler.
One way to do this is to write 6 statements, each of which, if possible, performs a shift to the left of one space.
eg.
update table set field1 = field2, field2 = null from table where field2 is not null and field1 is null
Moves content from field2 to field 1, if and only if field1 is empty and field 2 is not empty
Second statement:
update table set field2 = field3, field3 = null from table where field3 is not null and field2 is null
Does the same - and so on:
update table set field3 = field4, field4 = null from table where field4 is not null and field3 is null update table set field4 = field5, field5 = null from table where field5 is not null and field4 is null update table set field5 = field6, field6 = null from table where field6 is not null and field2 is null
Thus, that 5 operators as a whole - launching them as a package will gradually shift records by at least one batch - it will move more per batch in cases where the empty space on the left and all entries on the right are adjacent without spaces. Spaces will tend to move to the right, and so I assume that by running a batch at least 6 times, you should find yourself a dataset that matches what you want.
The actual sql you need will depend on how your RDBMS language deals with zeros or empty strings or something else, but the good news is that you only need 5 statements, and you only need to run them relatively a small number of times.
Probably smarter methods than this, but it's pretty simple, and each run of the package gives you one step closer to where you want to be. On the underside, this is a little awkward. If you need to run this periodically, I may be tempted to figure out something more elegant.
Depending on the type of data, you may need to run something that classifies / counts the number of records that you have for each combination / zero score. Thus, you may be able to reduce the number of runs that you have - most likely there are only 4 or 5 different templates, not the full 64.