nauniq is a command-line utility that identifies repeated lines even when they are separated by other records in the input.
The standard uniq command only detects consecutive duplicate lines. nauniq instead maintains information about previously encountered records, allowing it to filter repeated entries without sorting the source data.
The application provides several options for controlling how records are compared and how much information is retained in memory. Users can limit the number of remembered entries, compare selected portions of each line or store hashes instead of complete records.
It can also maintain a file containing unique records by appending only previously unseen entries. This makes it useful for collecting output from commands that may repeatedly produce the same information.
This is free and open source software.
Key Features
- Identifies duplicate lines even when they are not adjacent.
- Print only unique records or use –repeated to output duplicate records.
- Case-insensitive comparisons with –ignore-case.
- Limit the number of remembered entries using –num-entries to control memory consumption.
- Skip a specified number of leading characters when comparing records.
- Limit comparisons to a specified number of characters.
- Store MD5 hashes instead of complete lines to reduce memory usage for long records.
- Forget previously encountered entries when a specified regular expression matches.
- Append new records to an existing output file while checking its previous contents.
- Supports input and output filenames as command-line arguments.
Website: metacpan.org
Support: GitHub Code Repository
Developer: perlancar
License: Same terms as Perl 5 (Artistic License 1.0 or GNU General Public License v1.0)

nauniq is written in Perl. Learn Perl with our recommended free books and free tutorials.
| Explore Linux | |
|---|---|
| Best Free and Open Source Software - A huge collection of recommended free and open source software covering every major category. | |
| In-depth Linux Software Reviews - Detailed assessments of Linux software covering features, usability and overall quality. | |
| The Big List of Active Linux Distros - An extensive collection of actively developed Linux distributions. | |
| Open Source Alternatives - Alternatives to software and services from Google, Microsoft, Apple, Adobe, IBM, Autodesk, Oracle and others. | |
| Essential Linux System Tools - Indispensable utilities for monitoring, maintaining and managing Linux systems. | |
| Linux Productivity Tools - Useful utilities for improving productivity and streamlining everyday tasks. | |
| Alternatives to Popular CLI Tools - Modern alternatives to familiar command-line utilities supplied with Linux systems. | |
| Awesome Free Linux Game Tools - Tools, utilities and companion software that improve gaming on Linux. | |
| Machine Learning on Linux - Machine learning and deep learning software, self-hosted applications and practical tools. | |
| Saving Money with Linux - Practical ways to reduce electricity consumption and lower computing costs with Linux. | |
| Linux Candy - Fun, entertaining and sometimes delightfully quirky software from the lighter side of Linux. | |

Please read our Comment Policy before commenting.