Keep Lines Containing

Keep only lines that contain specific text

Input Text

Paste or type your text here

Options

Output Text

Processed text will appear here

How It Works

Keep only lines that contain specific text

Keep only lines that contain a specific word or string, discarding everything else. The opposite of "Remove Lines Containing" — this tool acts as a grep-style filter, extracting matching lines from logs, data files, or any multi-line text.

Key Features

  • Keeps only lines matching a search string
  • Case-sensitive and case-insensitive options
  • Multiple search strings support
  • Shows count of matching lines

How to Keep Lines Containing Text

  1. 1

    Paste your text

    Enter multi-line text to filter.

  2. 2

    Enter search string

    Type the word or string to keep lines for.

  3. 3

    Copy matching lines

    Click copy for only the lines containing your string.

Common Use Cases

  • Extracting error lines from large log files
  • Filtering CSV rows that contain specific values
  • Finding all lines mentioning a keyword in a document
  • Isolating specific entries from configuration files

Frequently Asked Questions

Is this like grep?
Yes. It works similarly to the Unix grep command, showing only lines that match the search string.

Related Text Tools