The easiest method to straighten and rearrange UV islands in Blender is by using the free add-on TexTools by renderjs.
After you installed TexTools, you find a new tab in the UV/Image Editor.

Step 1
In the first step, you want to rectify all the UV islands. Select one island, click the Rectify button then repeat the process for all the UV islands.

Step 2
Once you've rectified all islands, enter Face Select mode, then select the similar ones and rearrange them vertically at the top edge.

Step 3
In the next step, chose one island as template and scale the edges of the others vertically. Do this by selecting the same edges on each island except in the template island, then press S, then Y and then 0.
Repeat this for all edges.

Step 4
After that, turn on "Snap to Vertex", hit G, Y then press Ctrl while moving the edges vertically, until they snap at the same height as the template edge.
Repeat this for all edges.

Step 5
Now, position the islands roughly into a vertical stack, switch to Face Select mode, then press the "Align left" button to arrange them horizontally on the left edge.

Step 6
After that, turn on "Snap to Vertex", hit G, X, then press Ctrl while moving the right edges horizontally and move your mouse over the template until they snap at the same width as the right template edge.

Step 8
Repeat Step 1 to 7 for the second island group, then rearrange them by using the method in Step 2.
