Something like this Java app I wrote:
http://tj.umcus.org/WordArranger.jar
Should do what you want. To use, put it in the same directory as the text file, and just do in DOS prompt:
java -jar WordArranger.jar fileToRearrange
Where fileToRearrange is your file.
This assumes you have Java installed.
The program should create a new file called New fileToRearrange and all the words should be next to each other seperated by spaces.