New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --fields
opt to string split
#6770
Conversation
93ce226
to
a03fe55
Compare
--fields
opt to string split
--fields
opt to string split
So my cut manpage says it supports the following:
Looking through our scripts ( They can of course be left for later. |
A couple of ways this implementation is different to
and the fields may be printed out more than once:
Seems more versatile to me this way - any thoughts? Trying to think of whether there any possible gotchas to the end-user doing it this way... |
Code is probably amateurville, but I just added support for the "N-M" feature mentioned above. I'll leave N- and -M for someone else to do later since will probably need to overhaul everything to handle it. |
That's probably alright. It might be useful (say you're preparing a csv file for handling elsewhere). (cut sorts the fields and ignores duplicates, which seems weird) |
One thing I'm still not sure about is what to do if a specified field doesn't exist. Right now it just ignores it like |
Perhaps print nothing and return error if field is not found?
|
Fixed conflicts with master and made the feature return 1 if any of the given fields is non-existent. @faho Any thoughts apart from the code itself? |
So the use case shows a problem with this: You're gonna use it like Otherwise I think you got it. Returning 1 if nothing happened is what string tends to do, and so far it has worked well. Reordering seems useful, and it's a good feature. |
I guess I could add an option Also I instead found more cases (for completions anyway) look like this:
Where it wouldn't be all that different after: Note: I have not yet implemented the "2-" syntax |
Description
Adds
--fields
option tostring split
, similar to the onecut
has.string split
behaviourcut
skips over them)Fixes issue #
...Need to find out the issue where this may have been mentioned...
TODOs: