Giter Club home page Giter Club logo

Comments (5)

marcotrosi avatar marcotrosi commented on July 17, 2024 2

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.

koraa avatar koraa commented on July 17, 2024

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.

marcotrosi avatar marcotrosi commented on July 17, 2024

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.

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.

marcotrosi avatar marcotrosi commented on July 17, 2024

huniq

>

from huniq.

koraa avatar koraa commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.