🔁 文本去重Text Dedupe
粘贴或输入文本,一键删除重复的行。可选择去重方式、是否忽略大小写与空白、保留首次或末次出现,并可对结果排序。Paste or type text and remove duplicate lines instantly. Choose mode, case/space handling, keep first or last, and optional sorting.
① 输入文本① Input
② 去重选项② Options
③ 执行与结果③ Run & Result
使用说明How to use
- 粘贴多行文本(如名单、日志)Paste multi-line text (lists, logs)
- 选择去重方式:整行/连续/按键,并可忽略大小写、保留首次或末次Choose mode: whole-line/consecutive/by-key, with case/first/last options
- 查看去重结果,可复制或下载Review, then copy or download
示例:输入 苹果/香蕉/苹果 → 输出 苹果/香蕉(重复的苹果被去掉)Example: e.g. 苹果/香蕉/苹果 → 苹果/香蕉 (duplicate removed)
全程在你的浏览器本地完成,文本不会上传服务器。Runs entirely in your browser; your text is never uploaded.
把需要处理的文本粘贴到输入框,每行视为一条记录。选择去重方式后点击「去除重复」,结果会实时显示在下方,并提示移除了多少条重复。Paste text into the input box, one record per line. Pick a mode and click “Dedupe” — the result shows below with how many duplicates were removed.
整行去重 vs 连续重复Whole-line vs Consecutive
「整行去重」会删除全文所有重复行;「连续重复」只去掉紧挨着的重复行,适合清洗日志等连续重复内容。“Whole line” removes all duplicate lines globally; “Consecutive” only removes adjacent repeats — handy for log files.
📚 三种去重策略怎么选?📚 Which dedupe strategy to use?
整行去重:全文范围内每个唯一行只保留一次(可保留首次或末次出现)。适合名单、关键词、导出列表——「同一内容出现多次就算重复」。实现上用哈希表 O(n) 完成,十万行也是毫秒级。Whole-line: keeps each unique line once across the whole text (first or last occurrence). Best for lists, keywords and exports — “same content more than once is a duplicate”. Runs in O(n) with a hash table, milliseconds even for 100k lines.
连续重复:只删除彼此相邻的重复(如日志里连续 N 行相同报错),不相邻的相同行保留——因为「位置相邻」才是其判定标准,适合时序数据与日志去抖。Consecutive: removes only adjacent duplicates (e.g. repeated error lines in a log); non-adjacent identical lines are kept — proximity is the criterion, ideal for time-series and log de-dup.
按键去重(正则):不比较整行,而是用正则从每行提取一个「键」(第一捕获组,如 (\d+) 取行内第一个数字),按键去重。适合「行内容不同但按 ID/编号判断重复」的场景,例如带时间戳的日志按订单号去重。三种策略可配合「忽略大小写」「比较前去空格」「忽略空行」与排序组合使用。By regex key: instead of comparing whole lines, a regex extracts a “key” from each line (capture group 1, e.g. (\d+) for the first number) and dedupes by that key. Perfect when lines differ but duplicates are judged by an ID/number — e.g. timestamped logs deduped by order number. All three can combine with ignore-case, trim, skip-empty and sorting.