Giter Site home page Giter Site logo

Field ranges about tsv-utils HOT 3 CLOSED

ebay avatar ebay commented on August 11, 2024
Field ranges

from tsv-utils.

Comments (3)

jondegenhardt avatar jondegenhardt commented on August 11, 2024

This is actually next on my todo list, for all the reasons you mention

from tsv-utils.

Llammissar avatar Llammissar commented on August 11, 2024

Oh really? Great! A thought I had: it may be useful to have something like opDollar (e.g. so we can easily express ideas like "all but the last two of however many columns this is"), but I'm not sure how to make it not-super-ugly in the shell.

from tsv-utils.

jondegenhardt avatar jondegenhardt commented on August 11, 2024

Added support for field ranges anywhere a list of fields can be entered. A field range is a pair of field numbers separated by a hyphen: 3-7. Reverse order is supported as well: 7-3. A field list is a sequence of field numbers and ranges. e.g: 1,7-14,30-25,9. Some examples:

tsv-select --fields 1,2,17-33,10-7  data.tsv
tsv-summarize --group-by 3-5 --median 7-17
tsv-uniq --fields 7-10 data.tsv

I decided not to support incomplete ranges like 3-. This is a significant complication when lines have variable numbers of fields, and involves changing the inner loop of any tool supporting it. (Even ignoring variable length rows it would have involved significantly more work.) Note that this is not an issue for Unix cut, as it does not support re-ordering fields. It can always print to the end of the line when an incomplete range is involved.

from tsv-utils.

Related Issues (20)

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.