Skip to content
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

Why restrict on single character delimiter (in non regex mode) #16

Closed
passcod opened this issue Jul 7, 2021 · 3 comments
Closed

Why restrict on single character delimiter (in non regex mode) #16

passcod opened this issue Jul 7, 2021 · 3 comments

Comments

@passcod
Copy link

passcod commented Jul 7, 2021

(apologies for edit, fat thumbs)

While cut doesn't support it, I don't see why multichar delimiters should not be allowed; yes it's available with regex (but needs escaping sometimes) but why have the restriction in the first place?

It doesn't even really matter for cut compat, given that as cut doesn't support them, all it would do is not error for cut-invalid values — presumably not something a script would rely on

@passcod passcod changed the title Why restrict on single character delimiter (! Why restrict on single character delimiter (in non regex mode) Jul 7, 2021
@passcod
Copy link
Author

passcod commented Jul 7, 2021

Oh and sorry if this was changed in 0.3 too!

@sstadick
Copy link
Owner

sstadick commented Jul 7, 2021

You can! I'll add a section in the README about it.

# with string literalprintf 'this$;$is$;$a$;$test\na$;$b$;$3$;$four\n' > test.txt
❯ hck -Ld'$;$' -f3,4 ./test.txt
a       test
3       four
# with an interesting regexprintf 'this123__is456--a789-test\na129_-b849-_3109_-four\n' > test.txt
❯ hck -d'\d{3}[-_]+' -f3,4 ./test.txt
a       test
3       four

Theoretically this worked in v0.2.0, but I kind of borked a whole codepath (as you discovered, sorry!), so it probably looked like it wasn't supported.

(edit, see https://github.com/sstadick/hck#splitting-on-multiple-characters)

@sstadick sstadick closed this as completed Jul 7, 2021
@sstadick
Copy link
Owner

sstadick commented Jul 8, 2021

(reopening so that you can close it if this does actually satisfy your question!)

@sstadick sstadick reopened this Jul 8, 2021
@passcod passcod closed this as completed Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants