Home › Text Tools › Filter Lines Containing Text

Filter Lines Containing Text

Paste any list, log or CSV and keep only the lines that contain your words, or remove them. Match any or all terms, line starts and ends, exact lines or regular expressions, and see how many lines matched.

Last updated:

0 lines
Advertisement
Advertisement

How to use the Filter Lines Containing Text

  1. Paste your text or open a .txt, .csv or .log file. Each line is checked separately.
  2. Choose Keep or Remove for the lines that match.
  3. Pick how a line matches (contains any term, all terms, starts with, ends with, exact or regex) and type your terms, one per line.
  4. Set options such as Case-sensitive or Whole words only. The result updates as you type.
  5. Copy or download the result, check the Filtered out tab, or click Use as input to filter again.

Match types explained

Match typeTermMatchesDoes not match
Contains ANYred
blue
red car · dark blue skygreen tree
Contains ALLinvoice
paid
Invoice 204 paidInvoice 205 overdue
Starts with## comment linevalue = 5 # note
Ends with.jpgphotos/cat.jpgphotos/cat.jpg.bak
Is exactlyN/AN/AN/A (pending)
Regular expression^\d{3}-\d{4}$555-0199Call 555-0199

Handy filters to copy

  • Clean up a log: Keep lines, contains ANY, terms error and warning. Switch to Remove to hide routine INFO and DEBUG noise instead.
  • Remove comments from a config file: Remove lines, starts with, term # (and // for code), with Trim spaces ticked so indented comments are caught.
  • Find rows in a CSV: Keep lines, contains ALL, terms such as 2026 and Paid. Note that the header row is filtered like any other line.
  • Lines with an email address: regular expression [\w.+-]+@[\w-]+\.[\w.]+.
  • Lines that are only numbers: regular expression ^\s*-?\d+(\.\d+)?\s*$.
  • Lines longer than 80 characters: regular expression ^.{81,}$.

Working on the command line? This tool does the same job as grep (keep matches), grep -v (remove matches), grep -i (ignore case) and grep -w (whole words), without installing anything.

Frequently asked questions

How do I remove all lines containing a specific word?

Paste your text, choose Remove matching lines, leave the match type on contains ANY of the terms and type the word in Terms. Every line that contains it disappears from the result, and the Filtered out tab shows the lines that were removed.

Is the search case-sensitive?

No, not by default: error matches Error and ERROR. Tick Case-sensitive when capital letters matter, for example to tell the code ID from the word id.

What is the difference between ANY and ALL?

With ANY, a line matches when it contains at least one of your terms (OR). With ALL, it must contain every term somewhere in the line (AND), in any order. To keep lines that contain none of the terms, choose ANY with Remove matching lines.

What does Whole words only do?

It stops a term from matching inside a longer word. With Whole words only, cat matches 'the cat sat' but not 'category' or 'concatenate'. Letters, digits and underscores count as word characters.

Can I use regular expressions?

Yes. Choose matches a regular expression and put one pattern per line; a line matches if any pattern matches. Patterns use JavaScript syntax, for example ^\d{4}- for lines starting with four digits or @example\.com$ for lines ending in that domain. Invalid patterns show an error instead of wrong results.

Is there a size limit?

There is no fixed limit. Files of many megabytes and hundreds of thousands of lines work in modern browsers; very large files simply take a moment longer. Your text never leaves your device.

Does it keep the original order of lines?

Yes. Lines stay in their original order. Turn on Add line numbers to see where each kept line came from, or open the Highlighted matches tab.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Remove Duplicate LinesDelete duplicate lines from any list, ignoring case or spaces, keep first or last, and sort.Remove Empty LinesDelete blank and whitespace-only lines, or collapse gaps to one, with before/after line counts.Sort Lines AlphabeticallySort a list A-Z, Z-A, numerically, naturally or by length, or shuffle it.Find and Replace TextFind and replace words or regex patterns in any text, with match highlighting and undo.Online Word ProcessorFree browser word processor with headings, lists, tables and images. Autosaves; export DOCX or PDF.Remove Line BreaksStrip line breaks and extra spaces, keep paragraphs if you want.Case ConverterConvert text to UPPERCASE, lowercase, Title Case, camelCase and more.MLA Format GeneratorBuild an MLA 9 heading, title page layout and Works Cited entries.Lorem Ipsum GeneratorGenerate placeholder text as paragraphs, words or lists, with HTML.Text RepeaterRepeat any text or emoji up to 100,000 times with custom separators.Add Line NumbersNumber every line of your text with custom start, step, padding and separator, or remove numbers.Add Prefix and Suffix to LinesAdd text to the start and end of every line: quotes, commas, bullets or SQL lists.Comma SeparatorTurn a column of lines into a comma separated list and back, with any delimiter.Text to Handwriting ConverterTurn typed text into realistic handwriting on notebook paper and save it as PNG or PDF.Japanese Kana ConverterConvert romaji to hiragana or katakana, kana to romaji, and hiragana to katakana instantly.Pinyin Tone ConverterTurn pinyin tone numbers (ni3 hao3) into tone marks (nǐ hǎo), or tone marks back into numbers.Remove Extra SpacesClean up double spaces, tabs, blank lines, non-breaking and invisible spaces in one click.Random Word GeneratorGenerate random English words by type, length, first letter and syllables, then copy them.List RandomizerShuffle a list into random order, pick random items or split it into fair teams.Email ExtractorPull every unique email address out of text or files, sort, filter by domain and export CSV.URL ExtractorExtract every link from text or HTML, remove duplicates, filter by domain or protocol.Strip HTML TagsRemove HTML tags and get clean plain text with line breaks and decoded entities.Online NotepadPrivate notepad that autosaves notes in your browser, with find, word count and .txt download.Remove PunctuationStrip all or only selected punctuation from text, with smart options for apostrophes and numbers.Text SplitterSplit long text into chunks by characters, words, lines or a delimiter, with numbering and copy.Remove AccentsStrip accents and diacritics from text (é→e, ñ→n, ß→ss, ø→o) instantly, live as you type.Sort NumbersPull numbers out of any text and sort them ascending or descending, with sum, average and median.Thread SplitterSplit long text into numbered X, Threads, Bluesky or Mastodon posts at sentence boundaries.Duplicate Word FinderFind repeated words in your text: doubled words like "the the" and overused words, highlighted.Alternating Caps GeneratorTurn text into aLtErNaTiNg caps, random caps or alternating words, then copy it.Random Paragraph GeneratorGenerate readable random English paragraphs by topic and length for writing and design.Random Sentence GeneratorGenerate random grammatical sentences: simple, compound, complex and questions.Markdown to Plain TextStrip Markdown syntax and keep clean plain text with lists, line breaks and link URLs.SRT to TextTurn SRT or VTT subtitles into a clean transcript with paragraphs, with or without timestamps.Transcript CleanerRemove timestamps, speaker labels and filler words like um and uh, and fix broken line breaks.Extract Numbers from TextPull every number out of text: decimals, negatives and percentages, with sum, average and CSV.Extract Phone NumbersFind phone numbers in any text, normalize them to E.164, remove duplicates and export CSV.Paragraph to Bullet Points ConverterSplit paragraphs into bullet points by sentence or clause, with your choice of bullet style.DNA Reverse ComplementGet the reverse, complement or reverse complement of DNA/RNA, FASTA and IUPAC codes supported.Focus Reading ConverterBold the first letters of every word for faster, focused reading. Copy as rich text or HTML.Memo GeneratorWrite a business memo in standard To/From/Date/Subject format, then print, copy or save as .docx.PDF Text CleanerFix text copied from a PDF: join broken lines, undo hyphen splits, drop page numbers and headers.Pros and Cons List MakerWeigh a decision with a weighted pros and cons list, a score, a verdict and easy export.Remove Numbers from TextStrip all numbers and digits from text, keep MP3-style words or ordinals, and tidy the spaces.Return Policy GeneratorCreate a return and refund policy for your store as text or HTML, with a refund example.Screenplay FormatterType a script in plain text (Fountain) and get a properly formatted screenplay, page count and PDF.Word ChangerSwap words for synonyms in your text, then click any word to cycle through alternatives.Words That End WithFind English words ending in any letters or suffix, filtered by length and sorted by score.Annotated Bibliography GeneratorBuild an APA or MLA annotated bibliography with hanging indents and download it as DOCX.EPUB to Text ConverterExtract plain text from EPUB e-books, pick chapters, count words and download a TXT file.Extract Dates from TextFind every date in text, in any common format, and convert them all to one format you choose.Extract Text Between DelimitersPull out every piece of text between brackets, quotes, HTML tags or your own start and end markers.Recipe Shopping List GeneratorPaste several recipes and get one combined grocery list with merged amounts, by store section.One Word Per LineSplit any text into a list with one word per line; strip punctuation, dedupe, lowercase and sort.Recipe FormatterPaste a messy recipe and get clean ingredients, numbered steps, scaling and a printable card.Remove Words from TextDelete a list of words or phrases from any text and see how many times each one was removed.Reverse Line OrderFlip the order of lines, list items or paragraphs so the last becomes first.Pairwise Sequence Alignment ToolAlign two DNA or protein sequences, global (Needleman-Wunsch) or local (Smith-Waterman), with identity %.Sort Lines by LengthSort lines from shortest to longest or the reverse, with ties sorted A-Z and lengths shown.Sort Words AlphabeticallyPut the words in any text in A-Z or Z-A order, remove duplicates and pick a separator.Sentence SplitterSplit text into one sentence per line, smart about abbreviations, decimals and quotes.Text to Table ConverterTurn tab, comma, pipe or space separated text into a table to copy as rich text, Markdown or plain text.Text TruncatorShorten text to a character, word or sentence limit without cutting words, with an ellipsis.Bulk Find and ReplaceApply a whole list of find → replace pairs to your text at once, with a per-pair change log.Contraction ConverterExpand contractions (don't → do not) for formal writing or contract phrases for a casual tone.Count Duplicate LinesCount how many times each line appears, sorted by frequency, with duplicates-only and CSV export.Double Space TextAdd blank lines between lines or paragraphs (1.5, double, triple spacing) or remove them again.Em Dash ReplacerReplace em and en dashes with commas, hyphens or periods and normalize ellipses and fancy punctuation.
See all 96 Text Cleaning & Formatting →