Live data from Hacker News

Show HN: Choose – An alternative to cut and sometimes awk

github.com

1–10 of 49 posts

Re: Show HN: Choose – An alternative to cut and sometimes awk

#2
Not sure why it is even compared to awk instead of just cut. It could've been introduced as cut-like command with regex input field separator. Or at least not say things like:

>However, the awk command is not ideal for rapid shell use

And

>cut is far from ideal for rapid shell use, because of its confusing syntax

anything new is confusing until you learn enough to be comfortable

>ranges are just plain difficult to get right on the first try

and how does choose become easy to use with ':' character instead of '-'

Is this a typo or does inclusive/exclusive depend on whether first number is specified?

>choose 2:5 # print everything from the 2nd to 5th item on the line, _inclusive_ of the 5th

>choose :3 # print the beginning of the line to the 3rd item _exclusive_

Re: Show HN: Choose – An alternative to cut and sometimes awk

#3
I can't understand why you are mentioning awk. Cut or choose cannot be compared to awk, awk is a programming language.

Also I don't think that it's so much easier to use than cut. On the other hand every *nix system has cut so if you make scripts with it they are portable.

Re: Show HN: Choose – An alternative to cut and sometimes awk

#4
post #3

I can't understand why you are mentioning awk. Cut or choose cannot be compared to awk, awk is a programming language. Also I don't think that it's so much easier to use than cut. On the other hand every *nix system has cut so if you make scripts with it they are portable.

> I can't understand why you are mentioning awk. Cut or choose cannot be compared to awk, awk is a programming language.

Because 99% of awk IRL use is just as a fancier cut.

It's very rare someone even sets a variable using awk. If you do it, you are a statistical rarity.

> Also I don't think that it's so much easier to use than cut. On the other hand every *nix system has cut so if you make scripts with it they are portable.

I, for one, never remember the syntax for cut. If "choose" gets a deb, I'll use it: Python slicing is something familiar to me.

I don't care if cut is on every unix system: if I have the possibility to install things on the machine, then I'll just install what I need. I have a script for that. If I don't, I'll google/man/--help GNU commands as usual.

And as for writing shell scripts, I use Python anyway.

Re: Show HN: Choose – An alternative to cut and sometimes awk

#6
post #2

Not sure why it is even compared to awk instead of just cut. It could've been introduced as cut-like command with regex input field separator. Or at least not say things like: >However, the awk command is not ideal for rapid shell use And >cut is far from ideal for rapid shell use, because of its confusing syntax anything new is confusing until you learn enough to be comfortable >ranges are just plain difficult to ge…

I heard those arguments when ag went out as an alternative to grep, and ffind as an alternative to find.

But now, I install their successors, ripgrep and fdfind, on all my machines. Including the windows ones.

Re: Show HN: Choose – An alternative to cut and sometimes awk

#7
Someone should make a bundle installer with this, bat, fdfind and ripgrep. I do enjoy those alternative to GNU, and install as many as I can: they are easier to use, usually faster, and just make more sense to my brain.

This pain is real: https://xkcd.com/1168/

Re: Show HN: Choose – An alternative to cut and sometimes awk

#8
Hmm, so compared to cut this

1. saves -f because it doesn’t support cut’s -b and -c modes (edit: actually -c is supported, I just didn’t see it);

2. Uses -f instead of -d, making it rather confusing for cut users;

3. Uses : instead of - for range specifications;

4. Offers an exclusive indexing mode;

5. Misses a bunch of other cut features (assuming coreutils cut).

Not sure I see much appeal...

Edit: Another thing I missed: regex separator instead of just character list.

Re: Show HN: Choose – An alternative to cut and sometimes awk

#10
post #2

Not sure why it is even compared to awk instead of just cut. It could've been introduced as cut-like command with regex input field separator. Or at least not say things like: >However, the awk command is not ideal for rapid shell use And >cut is far from ideal for rapid shell use, because of its confusing syntax anything new is confusing until you learn enough to be comfortable >ranges are just plain difficult to ge…

I heard those arguments when ag went out as an alternative to grep, and ffind as an alternative to find. But now, I install their successors, ripgrep and fdfind, on all my machines. Including the windows ones.

I do not have an issue with this command, regex field separator and negative index alone makes it a good alternative over cut. And I use ripgrep too. I'm bothered by the description.

I would even suggest the command to add ability to invert the ranges, byte selection (if -c is character and not byte selection), add examples for character splitting in README, etc.

Post reply on HN