>_devtools

Line Tools: Sort, Dedupe, Filter & More

Sort, reverse, shuffle, deduplicate, trim, number, prefix, and filter lines of text, or extract regex matches.

What this does

Paste a list, pick an operation, and get the result immediately. Every operation works on whole lines and keeps your line endings (LF or CRLF) and the trailing newline as they were.

Operations

  • Sort lines ascending or descending: alphabetical (by character code), natural (file2 before file10), or by line length, optionally ignoring case. Equal lines keep their original order.
  • Remove duplicate lines, ignoring case and/or surrounding whitespace, keeping the first or the last copy. You can also keep only the lines that repeat (like uniq -d) or only the lines that never repeat (uniq -u), and unlike uniq the lines do not have to be adjacent.
  • Remove empty lines, with or without whitespace-only lines.
  • Reverse the order of the lines, or shuffle them randomly.
  • Trim whitespace from the start, end, or both sides of each line.
  • Number lines from any starting number, with a custom separator, optional right-aligned numbers, and the option to skip empty lines. Write \t for a tab.
  • Prefix / suffix every line, for example to quote and comma-separate a list for SQL or JSON. \t inserts a tab.
  • Filter or extract: keep or remove the lines containing some text or matching a regular expression, or extract just the matches. With a capture group in the pattern, the first group is extracted.

Example

To pull the error codes out of a log, choose “Filter / extract”, set the action to “Extract matches only”, match as a regular expression, and use ERROR (\w+). Each line containingERROR timeout produces timeout.

Notes

Use “Use as input” to chain operations, for example sort and then remove duplicates. Regular expressions use JavaScript syntax. The work runs in a background thread and is stopped if a pattern takes too long (catastrophic backtracking). You can also open a text file instead of pasting.

Privacy

This runs entirely in your browser. Nothing is uploaded.