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

mlr unspace verb #1167

Merged
merged 4 commits into from
Jan 1, 2023
Merged

mlr unspace verb #1167

merged 4 commits into from
Jan 1, 2023

Conversation

johnkerl
Copy link
Owner

@johnkerl johnkerl commented Jan 1, 2023

Since PPRINT format uses spaces as delimiters, PPRINT output is not invertible if data keys or values contain spaces. mlr unspace helps.

Before:

$ mlr --c2p cat data/spaces.csv
column 1 column 2 column 3
apple    ball     cat
dale egg fish     gale
$ mlr --icsv --opprint cat data/spaces.csv | mlr --ipprint --oxtab cat
mlr: mlr: CSV header/data length mismatch 6 != 3 at filename (stdin) line  2.
.

After:

$ mlr --c2p unspace data/spaces.csv
column_1 column_2 column_3
apple    ball     cat
dale_egg fish     gale
$ mlr --icsv --opprint unspace data/spaces.csv | mlr --ipprint --oxtab cat
column_1 apple
column_2 ball
column_3 cat

column_1 dale_egg
column_2 fish
column_3 gale

@johnkerl johnkerl merged commit b518bf0 into main Jan 1, 2023
@johnkerl johnkerl deleted the kerl/unspace branch January 1, 2023 21:44
@johnkerl johnkerl changed the title mlr unspace verb mlr unspace verb Mar 2, 2023
@aborruso
Copy link
Contributor

aborruso commented Mar 3, 2023

really useful, thank you very much

@johnkerl
Copy link
Owner Author

johnkerl commented Mar 3, 2023

really useful, thank you very much

Thanks! :)

@archetyped
Copy link

Nice! If there were also a verb to change the case of keys (e.g. lowercase, uppercase), fields could be normalized across different files without having to use the nuclear $ = {} option in a put expression 👍

@johnkerl
Copy link
Owner Author

johnkerl commented Mar 4, 2023

nuclear $ = {}

LOL 😁

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

Successfully merging this pull request may close these issues.

3 participants