diff -u <(sjis_csv_to_json a.csv) <(sjis_csv_to_json b.csv) | vim -R -
Created
September 12, 2022 06:26
-
-
Save tamakiii/956104229a6ae57b2b89a3f25c97b4c6 to your computer and use it in GitHub Desktop.
diff Shift-JIS CSV with jq (CSV to JSON conversion)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sjis_csv_to_json() { | |
nkf $1 | jq -R -s -f <(echo 'split("\n")|map(split(","))|map({' $(count=0; for col in $(nkf $1 | head -n 1 | sed 's/\r//' | sed 's/,/\n/g'); do echo "\"$col\": .[$count],"; count=$((count + 1)); done) '})') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment