DAP Foundry dap.solutions
count-line-frequency-in-text · client-spa · v1 · stub

Count line frequency in text

Count how many times each distinct line appears in pasted text and get a CSV of line and count. Runs in this tab. Your inputs stay in this browser.

Input

Plain text, one item per line. A log, a list of URLs, anything. Up to 1 MB (1,048,576 bytes) and 50,000 lines. 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. Blank lines count as lines, and one line break at the very end does not. A line that holds only spaces or tabs is not blank: it is kept and counted as written, apart from an empty line. A byte order mark at the very start is not removed: it stays part of the first line. 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 a header line,count. One row per distinct line, most frequent first. Lines with the same count are sorted by character code (UTF-16 code units), not alphabetically, so Z comes before a and 10 comes before 9. The count is written in plain decimal digits, such as 1500, with no separator. Each row ends with a carriage return and a line feed (CRLF), the header row and 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 counted and sorted as pasted, before the apostrophe is added, so =1 and '=1 are counted apart and both show as '=1.

Limits

Errors

Every error names the field, the rule, and shows a small valid example. There is no support desk.

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.