A fruit list with repeats
- Lines to clean
- apple banana apple cherry banana apple
- Treat Apple and apple as the same line
- No
- Ignore spaces at the start and end of lines
- Yes
- Delete empty lines
- Yes
Result Unique lines: apple
banana
cherry
Lines in: 6
Lines kept: 3
Duplicates removed: 3
Empty lines removed: 0
- Read 6 lines; matching is case-sensitive with leading and trailing spaces trimmed.
- Kept the first copy of each line in its original position: 3 unique lines.
- Removed 3 repeated lines and 0 blank lines.
Six lines hold three distinct fruits; the first apple, banana and cherry stay in their original order.