Start with an untouched baseline
Text cleanup becomes difficult to audit when the original paste disappears. Save the raw input first, count its lines or delimited parts, and write down the intended output: a compact list, a sectioned document, or a list ready for import. A line that is empty, padded, or differently cased is not automatically disposable; its meaning comes from the destination.
Make comparison rules explicit
For a normal compact list, split the input, normalize repeated spaces and tabs, trim line edges, and remove blank rows. If blank rows separate groups, keep them or produce a second compact copy instead of destroying the structure. After that, run global deduplication with keep-first. Decide case sensitivity before the run: lowercasing for comparison can identify Alpha and alpha as duplicates, but it should not be confused with rewriting the displayed value.
Filter before the final order
Apply the filter after cleanup so the pattern sees the representation that will be delivered. Use a saved pattern or regex, decide whether empty rows may match, and check the filtered count. If source order represents priority, chronology, or editorial ranking, stop here and deliver the filtered order. Otherwise sort with text-basic-sorter using alphabetical, numerical, or length mode. Keep sorting non-random and record the direction; do not enable a second, hidden deduplication or trim pass.
Diagnose common failures
Unexpectedly missing entries usually come from case-insensitive matching, trimming that changed the comparison key, a filter pattern that was too broad, or a blank-line option that removed section markers. Unexpected reordering usually comes from sorting when the source order mattered. Compare the raw and final line counts, inspect the first retained copy of each duplicate group, and repeat the run with the same saved options before accepting the list.