I have a .csv
file that I'd like to sort pre-commit. I found this pre-commit hook file-contents-sorter
which sorts the file with the first value.
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0
hooks:
- id: file-contents-sorter
files: blackbox-files\.csv$
But I'd like to sort it first by the last value and then the first value. I was wondering if I can do something like this with pre-commit git hooks.
My csv file is something like this:
aaaa,bbbb
sssss,bbbb
fff,bbb
kkkk,eeee
www,ddd
The above code gives me this output:
aaaa,bbbb
fff,bbb
kkkk,eeee
sssss,bbbb
www,ddd
I'd like this output:
aaaa,bbbb
fff,bbb
sssss,bbbb
www,ddd
kkkk,eeee