Comments (5)
now I get it. a friend explained it to me.
huniq
removes non-consecutive and consecutive duplicates without sorting the input, unlike uniq
which can only remove consecutive duplicates and is therefore often combined with sort
.
maybe this is a better explanation?
anyways, now I get it and thanks for creating and sharing this tool with the world. bye bye :-)
from huniq.
The uniq
command only removes adjacent duplicates, hence sort | uniq
is used as the usual pattern removing duplicates. The purpose of the sort
step here is to get all duplicates to be next to each other.
This pattern can be replaced with huniq
.
If sorting the data was intended instead of being a side effect of removing duplicates, sort
still needs to be used.
from huniq.
The
uniq
command only removes adjacent duplicates, hencesort | uniq
is used as the usual pattern removing duplicates. The purpose of thesort
step here is to get all duplicates to be next to each other.This pattern can be replaced with
huniq
.If sorting the data was intended instead of being a side effect of removing duplicates,
sort
still needs to be used.
I totally understand that, but the text says that huniq
is the tool that does not sort, and as you just described uniq
is the tool that does not sort, so I guess it's a typo and you wanted to write uniq
instead of huniq
. Right?
Once again, the text says huniq
does not sort, but you just described that huniq
replaces sort | uniq
and this is contradicting.
from huniq.
from huniq.
It would be helpful to quote the full text here ;)
huniq replaces sort | uniq (or sort -u with gnu sort) and huniq -c replaces sort | uniq -c, assuming the data is sorted just so it can be passed to uniq. If having sorted output is desired, sort | uniq should still be used.
It was indeed the case that yesterday the clause saying "assuming the data is sorted just so it can be passed to uniq" was not present. I added this clause as extra clarification. This was already heavily implied by the presence of the specification pertaining to the stability of output order, but now it's explicit. Thank you for pointing this out.
from huniq.
Related Issues (19)
- build error HOT 1
- build error HOT 1
- Building problems on macOS HOT 3
- Rust based benchmarks & Tests
- Sort options
- Related post from Cloudflare HOT 2
- Benchmark against runiq HOT 1
- Don't output trailing delimiter if the input doesn't contain one HOT 1
- Suggestion: Use the Rust implementation of xxHash HOT 6
- Leak allocated memory
- musl binary HOT 2
- Create releases on GitHub
- Not much quicker than awk one-liner with numeric keys HOT 4
- Work incorrectly HOT 4
- Add a flag to use BTreeMap, so that the output is emited sorted
- Add an option for huniq -c to indent numbers like uniq -c HOT 1
- Handle stdout being closed prematurely
- csv files with huniq -c
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from huniq.