Okay so, what I need now is basically a script which can go through all of the import statements and sort them. They get unsorted over time sometimes and it would be nice if they could be resorted again. I will need a more complex program for this to work rather than doing it in shell scripts.
And that program was actually quite simple to write, so now all the import statements are sorted. Which is nice.