Line Filter

Size: 0 B, 0 characters

Filter rules:

0 / 0 lines
 
Size: 0 B, 0 characters

Online Line Filter – Keep or Remove Lines by Keyword

Filter any multi-line text in seconds: Paste a log file, CSV, config file, or any text — keep only the lines matching a keyword, or remove lines containing noise. Chain multiple rules to narrow results progressively, exactly like piping grep commands in a terminal — without opening a terminal.

What Is a Line Filter?

A line filter reads text line by line and keeps or discards each line based on whether it contains a search term or matches a pattern. It is the browser equivalent of two common Unix commands:

  • grep "term" — keep only lines that match the term
  • grep -v "term" — remove lines that match (keep everything else)

This tool is useful whenever the relevant information is buried among thousands of lines you don’t need: server logs, application traces, CSV exports, database query results, configuration files, or command-line output. Instead of writing shell commands or installing tools, paste your text and set filter rules — results update instantly.

How to Use

  1. Paste or upload your text into the input field.
  2. Type a search term in the first filter row.
  3. Click Keep or Remove to set the mode — the button toggles between the two.
  4. The output updates instantly as you type.
  5. Click + Add filter to chain another rule and narrow the results further.
  6. Enable Case sensitive to match exact casing, or Regex to use regular expressions.
  7. Click Copy to copy the result, or Download to save it as a .txt file.

Filter Modes: Keep vs Remove

Each filter rule operates in one of two modes:

  • Keep — only lines that contain the search term pass through. Lines that do not match are discarded.
  • Remove — lines that contain the search term are discarded. Lines that do not match pass through.

Click the mode button next to the search input to toggle. Both modes perform substring matching by default — a line is included or excluded if the term appears anywhere within it.

Chaining Rules: Sequential Filtering

Multiple rules apply in sequence — each rule filters the output of the previous one. This is the visual equivalent of chaining grep commands in a shell pipeline:

# Shell equivalent:
grep "POST" access.log | grep -v "/healthcheck" | grep " 5[0-9][0-9] "

The same result using three chained rules in the tool:

  1. Keep POST → shows only POST request lines
  2. Remove /healthcheck → drops health probe noise
  3. Keep 5 → shows only 5xx status lines among the remaining results

Add as many rules as needed. The order matters — the same terms in a different sequence can produce different output.

Regex Support

Enable Regex to use regular expression patterns instead of plain text:

PatternWhat it matches
POST|PUTLines containing either POST or PUT
^ERRORLines that start with ERROR
[45]\d\dLines containing a 4xx or 5xx HTTP status code
^\s*#Lines that start with a # comment (including indented)
\d{4}-\d{2}-\d{2}Lines containing a date in YYYY-MM-DD format
TODO|FIXME|HACKLines containing code annotation tags

When Regex is off, all terms are treated as literal substrings — dots, brackets, slashes, and other special characters are matched literally with no escaping needed.

If a pattern is invalid, the input field turns red and that rule is skipped. Other valid rules still apply. Correct the pattern and the error clears automatically.

Tips for Better Results

Start broad, then narrow. Begin with one Keep rule to isolate a rough set of lines, then add Remove rules to strip noise, then add more Keep rules. This is easier to debug than building a complex filter chain at once.

Use Remove for noise first. If your data contains repeated headers, health-check requests, or probe traffic, remove those first so they don’t pollute the output when you add Keep rules for the signal you need.

Keep Regex off when the term contains special characters. With Regex disabled, characters like ., [, (, and / are matched literally — safe for paths like /api/v2 or patterns like [warning] without escaping.

Use anchors for precision. ^ERROR matches only lines that start with ERROR, not lines that contain it later. \.js$ matches only lines ending in .js. Anchors dramatically reduce false positives when filtering structured output.

Test one rule at a time. Add a rule, verify the output, then add the next. One rule at a time makes it obvious when a rule is filtering too aggressively or not enough.

Common Filtering Examples

Keep only POST requests:

Before:

2024-01-15 10:23:01 GET /api/users 200
2024-01-15 10:23:02 POST /api/orders 201
2024-01-15 10:23:03 GET /api/products 200
2024-01-15 10:23:04 POST /api/payments 200

After (Keep: POST):

2024-01-15 10:23:02 POST /api/orders 201
2024-01-15 10:23:04 POST /api/payments 200

Remove health check noise:

Before:

2024-01-15 10:23:02 POST /api/orders 201
2024-01-15 10:23:05 GET /healthcheck 200
2024-01-15 10:23:04 POST /api/payments 200
2024-01-15 10:23:10 GET /healthcheck 200

After (Remove: /healthcheck):

2024-01-15 10:23:02 POST /api/orders 201
2024-01-15 10:23:04 POST /api/payments 200

Isolate errors using regex:

Before:

2024-01-15 10:23:01 GET /api/users 200
2024-01-15 10:23:04 POST /api/payments 500
2024-01-15 10:23:07 GET /api/orders 404
2024-01-15 10:23:11 POST /api/auth 200

After (Keep regex: [45]\d\d$):

2024-01-15 10:23:04 POST /api/payments 500
2024-01-15 10:23:07 GET /api/orders 404

Extract TODO and FIXME comments from code:

Before:

function processPayment(amount) {
  // TODO: validate amount is positive
  const result = charge(amount);
  // FIXME: handle timeout errors
  return result;
}

After (Keep regex: TODO|FIXME):

  // TODO: validate amount is positive
  // FIXME: handle timeout errors

Strip comment lines from a config file:

Before:

# Database settings
host=localhost
# Change port if running multiple instances
port=5432
user=appuser

After (Remove regex: ^\s*#):

host=localhost
port=5432
user=appuser

Use Cases

1. Narrowing Application and Server Logs

Server logs generate thousands of lines per minute. Use Keep rules to isolate specific request paths, user IDs, or error codes, then add Remove rules to strip probe traffic and known noise. A 50,000-line trace can be reduced to the 20 lines that matter — no terminal, no shell access, no grep command required.

2. Filtering CSV and Spreadsheet Exports

Exported CSV files often contain rows for every record type, region, or status. Use a Keep rule to show only rows where a column contains a specific value — a country, a status, or a category — before pasting into a report or importing into another tool.

3. Cleaning Command-Line Output

Output from docker ps, kubectl get pods, git log --oneline, or npm audit includes headers, separators, and unrelated entries. Paste the output, filter to just the relevant lines, and copy a clean result — faster than writing a shell one-liner.

4. Extracting Code Annotations

Use a Keep rule with the regex TODO|FIXME|HACK|NOTE to pull every annotation comment from a pasted code file in one pass. Useful when reviewing a large file or preparing a list of technical debt items without scrolling through thousands of lines.

5. Reviewing Diff Output

Large diffs contain additions, deletions, and context lines. Use a Keep rule with ^\+ or ^\- to show only changed lines, or keep only lines touching a specific function name — making a large changeset much faster to review.

6. Searching and Cleaning Configuration Files

Config files can be hundreds of lines long with extensive comments. Keep only lines containing a specific key, or remove comment lines (starting with # or //) to compare two config files side by side without the noise.

7. Filtering by IP Address and Access Logs

Keep lines containing a specific IP address or CIDR prefix to isolate traffic from one client. Remove known bot IP ranges or health probers. Combine with a regex pattern like 40[0-9]|5[0-9]{2} to keep only lines with specific HTTP status codes from that client.

Your Text Never Leaves Your Browser

When filtering logs that include session tokens, user data, internal API paths, or confidential system information, sending them to a server-side tool creates a real security risk.

At UPREK, our philosophy is simple: Your data stays yours. We don’t want it, we don’t collect it, and we can’t see it.

  • 100% Local Processing: All filtering runs locally on your machine via your browser’s JavaScript engine.
  • Zero Server Uploads: Your input text is never routed through, processed by, or uploaded to our servers.
  • No Logs or Backups: We do not log, store, or back up any of the text or files you input into this tool.
  • Instant Deletion: The text you work with exists only in your browser’s active memory. Close the tab and the data is gone.
  • Enterprise-Grade Security: Because we never possess or transmit your data, using UPREK makes you inherently immune to server-side data breaches.

Data as Parameter

You can pre-fill the input field with the ?input= query parameter:

https://www.uprek.com/en/tools/line-filter?input=line+one%0Aline+two

For private text, avoid sharing URLs that contain the content itself.

Frequently Asked Questions

What is the difference between Keep and Remove?

Keep passes through only lines that contain your search term — all non-matching lines are discarded. Remove does the opposite: lines that match are discarded and everything else is kept. Click the mode button next to the search input to toggle between the two. You can mix Keep and Remove rules freely within the same filter chain.

How does sequential (chained) filtering work?

Rules apply from top to bottom. The second rule filters the output of the first, the third filters the output of the second, and so on. This is equivalent to piping grep commands: grep "term1" | grep -v "term2" | grep "term3". The order of rules matters — the same rules in a different sequence may produce different results.

Can I filter lines by multiple independent keywords at once?

Yes, in two ways. Chained Keep rules use AND logic — each rule narrows the set further, so a line must match all of them to survive. For OR logic (a line matching any of several terms), use a single Regex rule with alternation: keyword1|keyword2|keyword3. This matches any line containing at least one of those terms.

Can I filter large log files?

Yes. Use the Upload button to load a file directly — it is read into your browser without being sent to any server. All filtering happens locally. The tool does not enforce a file size limit, though very large files (hundreds of MB) may be slower depending on your device's available memory.

What regex syntax is supported?

The tool uses JavaScript's built-in RegExp engine: character classes ([a-z], \d, \w, \s), quantifiers (*, +, ?, {n,m}), anchors (^ for line start, $ for line end), alternation (a|b), and groups ((abc)). Standard JavaScript regex rules apply. The g and m flags are applied automatically by the tool.

Does case sensitivity affect regex patterns?

Yes. When Case sensitive is off (the default), all matching is case-insensitive — the pattern error also matches ERROR and Error. Enable Case sensitive when you need the pattern to match exact casing. This applies to both plain text and regex rules.

What happens when a regex pattern is invalid?

The input field for that rule turns red and the rule is skipped — other valid rules still apply. Correct the pattern and the error clears automatically. Common mistakes: unbalanced brackets, an unescaped special character, or a quantifier with nothing to apply to.

Can I save my filter rules for later?

Not in the current version — rules exist only for the current browser session and reset on page refresh. If you plan to reuse a set of rules, copy the search terms before leaving the page.

Changelog

v1.0.0 May 20, 2026
  • Filter any multi-line text using multiple keep/remove rules with optional regex and case sensitivity
  • Chain rules progressively; invalid regex patterns highlighted inline
  • Upload a text file; copy filtered output or download as .txt