-
Notifications
You must be signed in to change notification settings - Fork 327
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
Feature request: xsv sort --unique #130
Comments
See also #82. |
I would also vouch for this. I find it better suited to unix worflows and it kinda mimicks the I would also filter duplicate row on the strict equality of the column selection. This means that in some cases some line would be arbitrarily chosen over the other but we can't be too clever about it anyway, except if we add some flag forcing equality to be done on whole line or on another selection of fields. I can probably open a PR about this if required. |
I opened #238 regarding this issue. |
Would prefer an approach on a built-in tool with in xsv. Otherwise, if restricted to adopt other tools, too many choice as there as numerous tools to run sql syntax on csv to do the same. It could be something like https://github.com/harelba/q/ An excerpt to illustrate e.g
You can use option |
Well, what I do (also just stumbled upon this): xsf fmt file.csv | xsv sort | uniq -u ...which also keeps the header line intact, since it only occurs once. |
@Radiergummi Nice – that will work for many use-cases. Just note that it doesn't work when the individual records contain newlines – e.g. user-generated content like posts in a StackOverflow or Reddit data dump (those are generally unique, but you get the point). |
@malthejorgensen Wouldn't those line breaks be escaped in the output from |
They are escaped by putting
> xsv fmt sample.csv | xsv sort | uniq -u
# Outputs `sample.csv` verbatim |
would be nice to have a --unique for xsv sort
for ex.:
The text was updated successfully, but these errors were encountered: