-
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
exclude command idea #61
Comments
I don't understand. Could you please write a specification for the command? (Pretend you're writing the end user documentation for how it's supposed to work.) |
Maybe this is more clear. Part of this is copied from
|
This might be even clearer:
|
@silverwind Indeed, that is much clearer, thank you. :-) When I read your first comment, I thought that you were asking for a symmetric difference but your examples showed a set difference. I now see that you want set difference. :-) I agree that this could be useful. I'm personally unlikely to work on it, but I'd be happy to mentor it. The |
It's somewhat like |
@BurntSushi Can I start on this? If so should I take the flag route (-v?) on the match command or create the new excludes command? |
@ms2300 Sure! It almost seems like this should be a flag on |
Just recently, I created a bash function for this purpose, might be helpful for an implementation: linediff() {
if [ $# -eq 0 ]; then
echo "Usage: linediff [added|removed|unchanged] oldfile newfile"
else
if [[ $1 == "added" ]]; then
cat "$2" "$2" "$3" | sort | uniq -u
elif [[ $1 == "removed" ]]; then
cat "$2" "$3" "$3" | sort | uniq -u
elif [[ $1 == "unchanged" ]]; then
cat "$2" "$3" | sort | uniq -d
fi
fi
} Maybe call it |
Ok awesome I'll get to work on it ... is there anything I should know outside of looking through xsv join? Xsv diff makes the most intuitive sense as a name to me since it's really just implementing set difference but I like the look of the old spec |
@ms2300 I actually saw someone requesting a "csv diff" tool, so |
I'll just go with exclude for now then and since it sounds like we're all on the same page on the underlying purpose if there's another name change it won't be a massive fix, yeah? |
@ms2300 Yup, sounds good to me! |
@ms2300 If you get stuck, please reach out to me on one of the Rust IRC channels. Email also works! |
@BurntSushi I have the command wired in and some initial implementation done but I'm swamped right now and I'll be another week or two, I'll for sure reach out to you if I get stuck anywhere though |
I think it would be handy to have a command to exclude matching columns from 2 csvs and print the remainder. For example:
source.csv:
exclusions.csv:
syntax could be similar to
join
:xsv exclude <columns1> <input1> <columns2> <input2>
, soThe text was updated successfully, but these errors were encountered: