Difference between revisions of "Find Duplicates"

From TED Notepad
 
Line 2: Line 2:
 
====Find duplicates.. (Alt+Ctrl+X)====
 
====Find duplicates.. (Alt+Ctrl+X)====
  
Searches the selection for duplicate {{defined|lines}}. Works the same way as the {{feature|Unique..}} tool does, but allows more options and choices, affecting behavior and results of the tool:
+
Searches the selection for duplicate {{defined|lines}}. Then either counts and/or removes duplicates, or removes unique lines, depending on following options and choices:
  
*{{field|All lines}} - Removes all duplicate {{defined|lines}}, keeping exactly one instance of each original line. The order of resulting {{defined|lines}} remains unchanged and from each two equal lines, the second one is removed. This is identical to the behavior of the {{feature|Unique..}} tool.
+
*{{field|All lines (remove duplicates)}} - Removes all duplicate {{defined|lines}}, keeping exactly one instance of each original line. The order of resulting {{defined|lines}} remains unchanged and from each two equal lines, the second one is removed. This is identical to the behavior of the {{feature|Unique..}} tool.
*{{field|Only unique lines}} - Removes all {{defined|lines}} that have duplicates, leaving only those {{defined|lines}} that were already unique. The order of resulting {{defined|lines}} remains unchanged.
+
*{{field|Unique lines only}} - Removes all {{defined|lines}} that have duplicates, leaving only those {{defined|lines}} that were already unique. The order of resulting {{defined|lines}} remains unchanged.
*{{field|Only duplicated lines}} - Removes all {{defined|lines}} that do not have duplicates, leaving only those {{defined|lines}} that do have duplicates. The resulting {{defined|lines}} are uniqued in the process, thus each resulting {{defined|line}} appears only once in the results. The order of resulting {{defined|lines}} remains unchanged.
+
*{{field|Duplicated lines only}} - Removes all {{defined|lines}} that do not have duplicates, leaving only those {{defined|lines}} that do have duplicates. The resulting {{defined|lines}} are uniqued in the process, thus each resulting {{defined|line}} appears only once in the results. The order of resulting {{defined|lines}} remains unchanged.
  
 +
Optionally, if the {{field|Count duplicates}} option is checked, the tool counts number of duplicates of each {{defined|line}} and adds these numbers to the results. Each resulting line then contains a number of its duplicates, written in brackets, in front of that line.
  
 +
Additionally, {{field|Ignore case}} option may be specified to {{defined|ignore case}} when matching duplicates.
  
{{todo}}
+
And finally, {{field|Leave empty lines}} option may be specified to spare all {{defined|empty lines}} from being removed, counted or otherwise modified. This can, for example, prevent unwanted {{defined|paragraph}} joining. If this option is not specified, even empty lines get counted and/or removed, which might not be always desired.
  
 
+
{{example_start}}Example:
{{example_start}}Result of {{field|Only duplicated lines}}; see example above:
+
{{example_body}}{{example_select|<nowiki>how much
{{example_body}}wood
+
wood
 +
would
 +
a woodchuck
 +
chuck
 +
if
 
a woodchuck
 
a woodchuck
 +
could
 
chuck
 
chuck
 +
wood</nowiki>}}
 +
{{example_end}}
  
 +
{{example_start}}Result of {{field|Duplicated lines only}}:
 +
{{example_body}}<nowiki>wood
 +
a woodchuck
 +
chuck</nowiki>
 
{{example_end}}
 
{{example_end}}
  
The {{field|Count duplicates}} option adds to the result the actual numbers of equal lines. Each resulting line will contain a number of its duplicates, written in brackets before the line.
+
{{example_start}}Result of {{field|All lines (remove duplicates)}} with {{field|Count duplicates}}:
 
+
{{example_body}}<nowiki>(1) how much
{{example_start}}Result of {{field|Count duplicates}}; see example above:
 
{{example_body}}(1) how much
 
 
(2) wood
 
(2) wood
 
(1) would
 
(1) would
Line 29: Line 40:
 
(2) chuck
 
(2) chuck
 
(1) if
 
(1) if
(1) could
+
(1) could</nowiki>
 
{{example_end}}
 
{{example_end}}
 
Additionally, {{field|Ignore case}} option may be specified to {{defined|ignore case}} when matching duplicates. {{field|Leave empty lines}} option may be specified to spare {{defined|empty lines}} from being uniqued to prevent joining of separate {{defined|paragraphs}}.
 

Revision as of 12:01, 8 May 2010

You see work in progress here; this section already reflects future TED Notepad version 6.0.0.14.
This section may contain incomplete, premature, or mistaken information, prone to change without notice.

Find duplicates.. (Alt+Ctrl+X)

Searches the selection for duplicate lines. Then either counts and/or removes duplicates, or removes unique lines, depending on following options and choices:

  • All lines (remove duplicates) - Removes all duplicate lines, keeping exactly one instance of each original line. The order of resulting lines remains unchanged and from each two equal lines, the second one is removed. This is identical to the behavior of the Unique.. tool.
  • Unique lines only - Removes all lines that have duplicates, leaving only those lines that were already unique. The order of resulting lines remains unchanged.
  • Duplicated lines only - Removes all lines that do not have duplicates, leaving only those lines that do have duplicates. The resulting lines are uniqued in the process, thus each resulting line appears only once in the results. The order of resulting lines remains unchanged.

Optionally, if the Count duplicates option is checked, the tool counts number of duplicates of each line and adds these numbers to the results. Each resulting line then contains a number of its duplicates, written in brackets, in front of that line.

Additionally, Ignore case option may be specified to ignore case when matching duplicates.

And finally, Leave empty lines option may be specified to spare all empty lines from being removed, counted or otherwise modified. This can, for example, prevent unwanted paragraph joining. If this option is not specified, even empty lines get counted and/or removed, which might not be always desired.

Example:
how much wood would a woodchuck chuck if a woodchuck could chuck wood
Result of Duplicated lines only:
wood a woodchuck chuck
Result of All lines (remove duplicates) with Count duplicates:
(1) how much (2) wood (1) would (2) a woodchuck (2) chuck (1) if (1) could