🧹 删除连续重复项(合并相邻的重复项目)Delete Repeating List Items
删除列表中连续重复的项目,像 Unix 的 uniq 命令:相邻的相同项目只保留一个(不相邻的重复会保留,保持原有的分段和顺序),也可以只保留没有连续重复的项目,或在每项前显示连续出现的次数;可忽略大小写和首尾空格。适合清理日志、去掉重复粘贴的行和压缩传感器数据,数据在本地处理。Delete items that repeat consecutively in a list, like the Unix uniq command. Runs of identical neighbouring items are collapsed to one, while repeats that aren't next to each other are kept, so the order and grouping stay intact. You can also keep only items that never repeat consecutively, or show how many times each run occurred. Case and surrounding spaces can be ignored. Handy for cleaning up logs, removing accidentally repeated lines and condensing sensor data. Processed locally.
使用说明与常见问题How-to & FAQ
「删除连续重复项(合并相邻的重复项目)」是什么?What is the Delete Repeating List Items tool?
删除列表中连续重复的项目,像 Unix 的 uniq 命令:相邻的相同项目只保留一个(不相邻的重复会保留,保持原有的分段和顺序),也可以只保留没有连续重复的项目,或在每项前显示连续出现的次数;可忽略大小写和首尾空格。适合清理日志、去掉重复粘贴的行和压缩传感器数据,数据在本地处理。Delete items that repeat consecutively in a list, like the Unix uniq command. Runs of identical neighbouring items are collapsed to one, while repeats that aren't next to each other are kept, so the order and grouping stay intact. You can also keep only items that never repeat consecutively, or show how many times each run occurred. Case and surrounding spaces can be ignored. Handy for cleaning up logs, removing accidentally repeated lines and condensing sensor data. Processed locally.
如何使用「删除连续重复项(合并相邻的重复项目)」?How do I use the Delete Repeating List Items tool?
在「删除连续重复项(合并相邻的重复项目)」中,把内容粘贴或输入到上方输入框,按需设置「输入分隔符」、「自定义」、「模式」,结果会实时显示在下方,点击「复制结果」即可复制。例如输入「x, x, y」,得到「x, y」。In the Delete Repeating List Items: Paste or type into the input box, adjust "Input separator", "Custom", "Mode"; the result appears below instantly — click "Copy result" to copy it. Example: "x, x, y" → "x, y".
和“删除重复行”有什么区别?How is this different from Remove Duplicate Lines?
“删除重复行”会去掉整个列表中所有重复出现的项目,无论它们是否相邻;本工具只合并“紧挨着”的重复项(与 Unix uniq 命令相同),A A B A 会变成 A B A,不相邻的重复被保留,适合保持日志、时间序列的先后结构。要全局去重请使用“删除重复行”。Remove Duplicate Lines drops every repeat anywhere in the list, adjacent or not. This tool only merges repeats that sit right next to each other, as the Unix uniq command does: A A B A becomes A B A, and non-adjacent repeats stay, which preserves the structure of logs and time series. For global de-duplication, use Remove Duplicate Lines.
几种模式分别对应什么?What do the modes correspond to?
“只保留一个”= uniq;“只保留没有连续重复的项”= uniq -u;“只保留连续重复过的项”= uniq -d;“显示连续次数”= uniq -c,在每项前加上“次数×”。Collapse runs to one = uniq; Only items that never repeat = uniq -u; Only items that repeated = uniq -d; Show run counts = uniq -c, prefixing each item with its count×.
分隔符是怎么自动识别的?How is the separator detected automatically?
“自动识别”按以下顺序判断:有换行就按行分隔,否则依次检查 Tab、分号、逗号(含中文逗号和顿号)、竖线,最后才是空格。用逗号、分号或 Tab 分隔时支持 CSV 式的双引号,例如 "北京, 中国" 会被当作一项。需要其他符号时选择“自定义”,可用 \n 和 \t 表示换行和 Tab。输出沿用原来的分隔符(包括自定义分隔符和中文逗号),含分隔符的项会重新加上双引号;空行默认忽略,不算作项目。Auto-detect works in this order: if there are line breaks, each line is an item; otherwise it checks for tabs, semicolons, commas (including the Chinese comma and enumeration comma), pipes and finally spaces. With comma, semicolon or tab separators, CSV-style double quotes are honoured, so "Paris, France" counts as one item. Choose Custom for anything else; \n and \t stand for a new line and a tab. The output keeps the original separator (including a custom one or the Chinese comma), items that contain the separator are quoted again, and blank lines are ignored by default.
输入和输出是什么样的?What does the input and output look like?
例如在「删除连续重复项(合并相邻的重复项目)」中输入 a ⏎ a ⏎ b ⏎ a ⏎ a ⏎ a ⏎ c,输出为:a ⏎ b ⏎ a ⏎ c(⏎ 表示换行)。For example, the Delete Repeating List Items turns the input a ⏎ a ⏎ b ⏎ a ⏎ a ⏎ a ⏎ c into: a ⏎ b ⏎ a ⏎ c (⏎ marks a line break).
有哪些选项可以调整?What options can I adjust?
「删除连续重复项(合并相邻的重复项目)」的设置:「输入分隔符」可选 自动识别、换行、逗号、分号、Tab、空格等(默认 自动识别);「自定义」可留空;「模式」可选 连续重复只保留一个、只保留没有连续重复的项、只保留连续重复过的项、显示连续次数(默认 连续重复只保留一个);可勾选:「忽略大小写」、「去掉首尾空格」(默认勾选)、「删除空项」。改动任一选项后结果会按新设置重新生成。Settings in the Delete Repeating List Items — "Input separator": Auto-detect, New line, Comma, Semicolon, Tab, Space, etc. (default Auto-detect); "Custom" optional; "Mode": Collapse runs to one, Only items that never repeat, Only items that repeated, Show run counts (default Collapse runs to one); tick boxes: "Ignore case", "Trim spaces" (on by default), "Drop empty items". Changing any option regenerates the result with the new setting.
处理大段文本会卡吗?Can it handle long text?
「删除连续重复项(合并相邻的重复项目)」在浏览器中直接处理,几 MB 以内的文本通常瞬间完成;文本不会离开你的设备。The Delete Repeating List Items runs in your browser; text up to a few MB is usually processed instantly and never leaves your device.
「删除连续重复项(合并相邻的重复项目)」免费吗?需要注册吗?Is the Delete Repeating List Items free? Do I need an account?
「删除连续重复项(合并相邻的重复项目)」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Delete Repeating List Items is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.