Collapse Consecutive Duplicate Lines
Collapse consecutive duplicate lines into single lines. Works like Unix uniq command with case-insensitive option.
About This Free Online Collapse Consecutive Duplicate Lines
Our free online tool collapses consecutive duplicate lines into single lines, similar to the Unix `uniq` command. If the same line appears multiple times in a row, only the first occurrence is kept. This is different from removing ALL duplicates, which removes any duplicate regardless of position. Consecutive-only mode is useful for cleaning up log files, removing repeated headers in data exports, and condensing repetitive output.
Features of Our Collapse Consecutive Duplicate Lines
- Collapse consecutive duplicate lines into single lines
- Case-insensitive matching option
- Preserves non-consecutive duplicates (unique to this mode)
- Shows count of collapsed lines
- Real-time results as you type
- Copy collapsed text to clipboard
- 100% private — browser-only processing
How to Use the Collapse Consecutive Duplicate Lines
Using this tool is simple and requires no signup or registration. Follow these steps:
- Paste your text with repeated consecutive lines into the input area.
- Toggle Case Insensitive if capitalization differences should be ignored.
- View the collapsed output instantly with count of merged lines.
- Click Copy to save the result.
Frequently Asked Questions About Collapse Consecutive Duplicate Lines
What is the difference between this and Remove Duplicate Lines?
This tool only removes consecutive (adjacent) duplicates — "A, A, B, A" becomes "A, B, A" because only the two A's next to each other are collapsed. Remove Duplicate Lines removes ALL duplicates globally — "A, A, B, A" becomes "A, B".
How does case-insensitive mode work?
When Case Insensitive is on, "Hello" and "hello" on consecutive lines are treated as duplicates and collapsed into one. When off, they are kept as separate lines.
When would I use this?
This is useful for cleaning up log files with repeated status lines, removing consecutive duplicates in data exports, condensing repetitive command output, and preprocessing text before other operations.
Why Choose Text Toolbox?
Text Toolbox provides free, private, and instant online text tools. Unlike other text utility websites that require signup accounts or send your data to servers, all our tools process your text entirely in your browser. This means your content never leaves your device — we cannot see it, store it, or share it. Our tools are fast, lightweight, and work on any device with a modern web browser.