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

New sub, gsub, and ssub verbs #1361

Merged
merged 4 commits into from
Aug 19, 2023
Merged

New sub, gsub, and ssub verbs #1361

merged 4 commits into from
Aug 19, 2023

Conversation

johnkerl
Copy link
Owner

@johnkerl johnkerl commented Aug 19, 2023

For issue #1356

Examples:

$ mlr --icsv --opprint --from docs/src/example.csv cat --filename
filename             color  shape    flag  k  index quantity rate
docs/src/example.csv yellow triangle true  1  11    43.6498  9.8870
docs/src/example.csv red    square   true  2  15    79.2778  0.0130
docs/src/example.csv red    circle   true  3  16    13.8103  2.9010
docs/src/example.csv red    square   false 4  48    77.5542  7.4670
docs/src/example.csv purple triangle false 5  51    81.2290  8.5910
docs/src/example.csv red    square   false 6  64    77.1991  9.5310
docs/src/example.csv purple triangle false 7  65    80.1405  5.8240
docs/src/example.csv yellow circle   true  8  73    63.9785  4.2370
docs/src/example.csv yellow circle   true  9  87    63.5058  8.3350
docs/src/example.csv purple square   false 10 91    72.3735  8.2430
$ mlr --icsv --opprint --from docs/src/example.csv cat --filename then ssub -f filename .csv ""
filename         color  shape    flag  k  index quantity rate
docs/src/example yellow triangle true  1  11    43.6498  9.8870
docs/src/example red    square   true  2  15    79.2778  0.0130
docs/src/example red    circle   true  3  16    13.8103  2.9010
docs/src/example red    square   false 4  48    77.5542  7.4670
docs/src/example purple triangle false 5  51    81.2290  8.5910
docs/src/example red    square   false 6  64    77.1991  9.5310
docs/src/example purple triangle false 7  65    80.1405  5.8240
docs/src/example yellow circle   true  8  73    63.9785  4.2370
docs/src/example yellow circle   true  9  87    63.5058  8.3350
docs/src/example purple square   false 10 91    72.3735  8.2430
$ mlr --icsv --opprint --from docs/src/example.csv cat --filename then sub -f filename '.*/' ''
filename    color  shape    flag  k  index quantity rate
example.csv yellow triangle true  1  11    43.6498  9.8870
example.csv red    square   true  2  15    79.2778  0.0130
example.csv red    circle   true  3  16    13.8103  2.9010
example.csv red    square   false 4  48    77.5542  7.4670
example.csv purple triangle false 5  51    81.2290  8.5910
example.csv red    square   false 6  64    77.1991  9.5310
example.csv purple triangle false 7  65    80.1405  5.8240
example.csv yellow circle   true  8  73    63.9785  4.2370
example.csv yellow circle   true  9  87    63.5058  8.3350
example.csv purple square   false 10 91    72.3735  8.2430
$ mlr --icsv --opprint --from docs/src/example.csv cat --filename then sub -f color,shape l X
filename             color  shape    flag  k  index quantity rate
docs/src/example.csv yeXlow triangXe true  1  11    43.6498  9.8870
docs/src/example.csv red    square   true  2  15    79.2778  0.0130
docs/src/example.csv red    circXe   true  3  16    13.8103  2.9010
docs/src/example.csv red    square   false 4  48    77.5542  7.4670
docs/src/example.csv purpXe triangXe false 5  51    81.2290  8.5910
docs/src/example.csv red    square   false 6  64    77.1991  9.5310
docs/src/example.csv purpXe triangXe false 7  65    80.1405  5.8240
docs/src/example.csv yeXlow circXe   true  8  73    63.9785  4.2370
docs/src/example.csv yeXlow circXe   true  9  87    63.5058  8.3350
docs/src/example.csv purpXe square   false 10 91    72.3735  8.2430
$ mlr --icsv --opprint --from docs/src/example.csv cat --filename then gsub -f color,shape l X
filename             color  shape    flag  k  index quantity rate
docs/src/example.csv yeXXow triangXe true  1  11    43.6498  9.8870
docs/src/example.csv red    square   true  2  15    79.2778  0.0130
docs/src/example.csv red    circXe   true  3  16    13.8103  2.9010
docs/src/example.csv red    square   false 4  48    77.5542  7.4670
docs/src/example.csv purpXe triangXe false 5  51    81.2290  8.5910
docs/src/example.csv red    square   false 6  64    77.1991  9.5310
docs/src/example.csv purpXe triangXe false 7  65    80.1405  5.8240
docs/src/example.csv yeXXow circXe   true  8  73    63.9785  4.2370
docs/src/example.csv yeXXow circXe   true  9  87    63.5058  8.3350
docs/src/example.csv purpXe square   false 10 91    72.3735  8.2430

@johnkerl johnkerl merged commit 793f52c into main Aug 19, 2023
5 of 6 checks passed
@johnkerl johnkerl deleted the kerl/sub-verbs branch August 19, 2023 21:23
@johnkerl johnkerl changed the title sub, gsub, and ssub verbs New sub, gsub, and ssub verbs Aug 31, 2023
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.

1 participant