Worked example
Before
pear
apple
pear
pear
appleAfter
pear 3
apple 2Pear has the higher count, and each first original value is followed by a tab and total.
Exactly what this changes
- Exact, case-sensitive comparison is the default. Each distinct line produces one output row in the form “line, tab, count”. The displayed value is copied from the first occurrence rather than rebuilt from a comparison key.
- Rows are ordered by count from highest to lowest. When two groups have the same count, the group whose first member appeared earlier in the input remains first, making the result deterministic and easy to trace.
- Blank lines are legitimate values. Their output row begins with a tab followed by the count, which can look unusual but does not silently discard the group. Original input lines are never changed in place.
Options and edge cases
- Case-insensitive comparison groups capitalized and lowercase forms while retaining the first spelling. Trimmed comparison ignores surrounding whitespace for grouping while preserving the first line’s exact leading and trailing characters.
- Use both options together when edge spacing and case should not create separate groups. Unicode composition is never normalized, so visually similar composed and combining strings may still count separately.
Edge case: The separator is one literal tab and is not escaped. If original lines contain tabs, the result remains plain text and may need a format-aware follow-up outside this tool.