Indexes a text file with words separated by spaces