Set intersection on lines
Find common lines treats each text as a list of lines and computes the intersection. The split point is a line containing exactly ---. Lines from text A are loaded into a JavaScript Set, then text B is walked line by line; any line that exists in the set is emitted to the output. Duplicates inside text B survive the filter, so a line that appears twice in B and once in A appears twice in the result.
Matching is exact: case, whitespace, and trailing spaces all count. Hello and hello are treated as different lines, and foo versus foo (with a trailing space) will not match. Strip whitespace beforehand with trim whitespace if you want to ignore margin spaces.
Output preserves the order in text B, not text A. That makes the tool useful for "filter list B down to entries that also appear in list A" workflows. For the opposite operation see find unique lines; for word-level overlap see word set intersection.
How to use find common lines in two texts
- 1Paste list A into the input panel, then a line with
---, then list B. - 2The output panel shows every line from B that also appears in A, in the order B presented them.
- 3Click Copy to copy the result, or Download to save as
.txt. - 4Swap A and B around the separator to keep the order from the other side.
- 5Pre-clean lines with trim whitespace if trailing spaces are blocking matches.
Keyboard shortcuts
Drive TextResult without touching the mouse.
| Shortcut | Action |
|---|---|
| Ctrl F | Open the find & replace panel inside the input Plus |
| Ctrl Z | Undo the last input change |
| Ctrl Shift Z | Redo |
| Ctrl Shift Enter | Toggle fullscreen focus on the editor Plus |
| Esc | Close find & replace, or exit fullscreen |
| Ctrl K | Open the command palette to jump to any tool Plus |
| Ctrl S | Save current workflow draft Plus |
| Ctrl P | Run a saved workflow Plus |
How the intersection works
Set membership lookup
Lines from text A are loaded into a JavaScript Set, giving O(1) lookup. Text B is then walked line by line and each entry is checked against the set.
Order follows text B
Output preserves the order in which lines appear in text B. If line foo appears at position 3 in B and position 7 in A, the output places it at position 3.
Exact, case-sensitive match
Matching is byte-for-byte. Hello does not match hello, and foo does not match foo with a trailing space. Use trim whitespace first if margin whitespace is causing misses.
Duplicates in B survive
A line that appears twice in B and once in A appears twice in the output. To collapse duplicates, run the result through remove duplicate lines.
Three-hyphen separator
The split between A and B is a line containing exactly ---. The separator line itself is not part of either set.
Worked example
Both banana and cherry appear in A and B, so they survive. apple is in A only and date is in B only. For those see find unique lines.
apple banana cherry --- banana cherry date
banana cherry
Settings reference
| Behaviour | Effect on output |
|---|---|
| Separator | A line containing exactly --- splits text A from text B. |
| Match rule | Exact string equality, case and whitespace sensitive. |
| Order | Follows text B. |
| Duplicates in B | Preserved. A repeated line in B that also exists in A appears once per occurrence. |
| Empty lines | Counted as a line. If both sides contain empty lines, they appear in the output. |
| Trailing whitespace | Significant. Strip first with trim whitespace if needed. |
| Missing separator | Output prompts for two halves split by ---. |
FAQ
Are matches case sensitive?
Apple in A will not match apple in B. Lowercase both sides first with lowercase if you want case-folded matching.