Find Distinct Lines

Contents  Previous  Next

 

Menu: Search > Find Distinct Lines

 

Default Shortcut Key: none

 

Macro function: FindDistinctLines()

 

The Find Distinct Lines command can be used to isolate all distinct lines within the current file.  The distinct lines are copied, with line numbers, into an untitled file.  No change is made to the current file during the operation. 

 

If a range of lines is selected, Find Distinct Lines will operate only on that portion of the file.

 

The results are presented in alphabetic order.  The Sort Lines command can be used to sort by line numbers, if desired.

 

The effect of this command is similar to the Find Unique Lines command, with an important difference: Find Unique Lines omits from its report any lines which are duplicated.  Find Distinct Lines includes duplicated lines, but places just a single instance of such lines in its report.  An example will clarify:

 

Original File's Content...

Find Unique Lines gives...

Find Distinct Lines gives...

AAA

AAA

AAA

BBB

DDD

BBB

BBB

EEE

CCC

CCC

FFF

DDD

CCC


EEE

DDD


FFF

EEE



FFF



 

 

bm1This command can be useful for isolating distinct entries in a list.  For example: a file contains lists of email address that were merged from multiple sources.  Find Distinct Lines could be used to create a new list that contains one occurrence of each distinct email address.  (Following the same example, a similar result could be obtained using the Delete Duplicate Lines command.)