Here's one way, there's plenty of others:
GetUniqueLines.kmmacros (6.0 KB)
For more information, see the wiki Searching the Forum for Answers section.