Line Filtering: Keep and Drop Get Swapped

Open Tool Line Filter

Three conditions, one direction

Line filtering picks what you want from many lines: by keyword, by length, by pattern. Direction is twofold, keep matches or drop matches. Conditions combine: contains a term, length at least some value, matches a regex. The tool groups them in one panel and outputs only the kept lines, leaving the source untouched. Log triage, list trimming and batch cleanup all use it, and reversing the direction is the standard mistake.

Steps

  1. Paste the text and back it up.
  2. Choose keep or drop, deciding which half you need.
  3. Enter keywords and confirm whether any or all must match.
  4. Set a minimum length to drop short lines.
  5. Add a regex for pattern matching, leaving it empty to use keywords.
  6. Run it, read the surviving count, then copy or download.

Logic, anchoring, length

Multiple keywords raise a logic question first, whether any hit keeps a line or all must, and the outcomes differ widely. An unanchored regex matches partially anywhere in the line, so full-line matching needs start and end anchors. Length counts characters including trailing spaces and tabs, so an indented line reads longer than it looks. Blank lines need an explicit decision, since keeping them floods the output. Headers get dropped easily, and a first line usually deserves keeping. Filtering is one-shot, with no rollback, so backup comes first.

Common mistakes

Swapping keep and drop and getting the opposite half. Assuming keyword logic and getting extra lines. Unanchored regexes matching too broadly. Length distorted by trailing whitespace. Headers dropped as non-matches. And running without a backup and losing the source.

Where filtering is the wrong tool

Structured data belongs in a spreadsheet or query language, since line filtering scrambles columns. Huge logs suit command-line tools rather than a browser. Audited logs keep their complete record, not just matches. Multi-condition analysis starts with filtering but does not end there. And treating filtered output as the full dataset loses evidence in review.

⏫︎