Diff two line lists
Paste two lists of lines and get which lines are only in A, only in B, or in both. Runs in this tab. Your inputs stay in this browser.
Input
Two lists. Put ---A--- before the first list and ---B--- before the second. Markers must be exactly ---A--- and ---B---, upper case, each alone on its line with no spaces, and the first ---A--- must come before the first ---B---. Anything before ---A--- is ignored. A later ---A--- or ---B--- line is compared as an ordinary line. The tool works on the text as it receives it. A byte order mark at the very start is not removed: it stays part of the first line, so that line is not a marker even when ---A--- follows it.
A line ends at a line feed, with or without a carriage return before it. A carriage return on its own stays part of the line, but this page's text box turns it into a line break before the tool sees it. A line break at the very end only closes the last line: it is not compared as a blank line in list B. A blank line has nothing on it, not even a space or a tab. Blank lines are compared like any other line and show as an empty first field, except that one blank line just before ---B--- is dropped. Input that is only white space is refused as empty. White space here is what JavaScript's trim removes: spaces, tabs, line breaks, form feeds, the byte order mark and the other Unicode space separators, but not a zero width space.
Output
CSV with header line,side. Sides are only_a, both, or only_b. Rows follow list A in order, each distinct line once, marked only_a or both. Then come the lines only in B, in B order, each once. Each row ends with a carriage return and a line feed (CRLF), the last row too. Quoting follows RFC 4180: a quoted cell is wrapped in double quotes, and each double quote inside it is doubled.
A cell that starts with =, +, -, @, a tab, a carriage return or a byte order mark gets a leading apostrophe (') so a spreadsheet shows it as text instead of running it. A plain number is left as it is: an optional + or -, then digits with at most one decimal point and at least one digit in all, then an optional exponent: e or E, an optional sign and at least one digit, such as -5, +1.5e3 or -.5. The whole cell must have that shape, so -5x gets the apostrophe. A cell that starts with a byte order mark gets the apostrophe before the mark, even when a plain number follows it. A cell that holds a comma, a double quote, a semicolon, a tab or a line break is quoted, and the apostrophe goes inside the quotes. A line is always the first cell, so it stays one cell when a spreadsheet splits on commas, semicolons or tabs and honours quotes. A line that already starts with an apostrophe is left as it is. Lines are matched as pasted, before the apostrophe is added, so =1 and '=1 are two different lines that both show as '=1.
Limits
- Exact match only. Case, spaces and accents must match.
- Up to 1 MB (1,048,576 bytes) and 50,000 lines. The marker lines, blank lines and anything before
---A---count. A line break at the very end does not count as another line. - Checks run in this order: empty input, size, line count, then the markers.
- No fuzzy match, no file upload.
How this was made
The core transform was written by hand into the stub registry.
Errors
Every error names the field, the rule, and shows a small valid example.
Inputs not stored
This runs in your browser tab. Your inputs are not uploaded or stored. The tool sets no cookie, uses no local storage and sends no analytics about your inputs.