A complete, thorough solution for this would be a formidable challenge with any regex-supported environment, Word/Writer the more so. See this post for why regexes are not a panacea for all text/email-matching problems that come up. That disclaimer out of the way, let's see if a practical solution is in reach...
For me, the practical solution would probably involve using regexes at some point in the process, but not without first fretting over the existence of such possibilities in the data:
firstname.lastname@example.org@yahoo.com... If emails really were randomly distributed in a text file, one would need to account for that case - the possibility of finding 2 emails next to each other, with no obvious separator. Is it
email@example.com or is it
firstname.lastname@example.org with the initial text
bob@ just gibberish? I'm guessing similar convincing examples can be found.
A reasonable first stab at the problem might be somewhere along these lines:
- find an email-matching regex I can live with (no such thing as the perfect one!)
- find all emails in the text file using that regex, and place them on new lines, appending some kind of marker text like 'w00t' at the beginning
- order the file (using :order command), separating all the 'w00t' lines, the ones with the emails we've found, from the rest of the unmatched junk
- go through the unmatched lines one by one to ensure you are not missing an real data there. If you find that you are, go back and modify the regex in #1 or manually extract those emails before continuing with step #2. Otherwise, there is the danger that you are splitting an email (which did not match the regex) into pieces, saving one part and throwing away the other.