Rev 1774 | Blame | Compare with Previous | Last modification | View Log | RSS feed
#!/bin/bash
orig=/tmp/orig.csv
ret=${1:-/tmp/result.csv}
# curl -sF "upload=@test.xls" -F utilisateur=22506 "http://cel/jrest/ImportXLS"
# $ sqlite3 .mozilla/firefox/*.default/cookies.sqlite<<<"SELECT * FROM moz_cookies WHERE baseDomain = 'cel' AND name = 'PHPSESSID';"
# GET -H "Cookie: PHPSESSID=ID" "http://cel/jrest/CelWidgetExport/export/?colonnes=standard,avance,etendu,baseflor&id_utilisateur=22506&format=csv > $ret
[[ ! -f $ret || ! -f test.xls ]] && echo "err" && exit 1
[[ ! -f $orig ]] && xls2csv -s cp1252 test.xls 2>/dev/null > $orig
[[ ! -f $orig ]] && echo "err" && exit 1
IFS=$'\n' cols=( $(csvtool head 1 $orig|tr , "\n") )
# test header
#diff <(csvtool head 1 $orig|tr , "\n") <(csvtool head 1 $ret |tr , "\n"); exit;
w=$(csvtool width $ret); w=32
# wdiff <(xls2csv -s cp1252 test.xls|csvtool readable -) <(csvtool readable $ret)
for i in ${cols[@]}; do
[[ $i =~ ^(Date Transmission|Date Création|Date Modification|Nom Commun|Identifiant|Ordre)$ ]] && continue;
echo "== $i";
wdiff -w "$(tput bold;tput setaf 1)" -x "$(tput sgr0)" -y "$(tput bold;tput setaf 2)" -z "$(tput sgr0)" <(csvtool namedcol "$i" $orig) <(csvtool namedcol "$i" $ret)
done
#ddiff <(csvtool namedcol Notes,Date /tmp/orig.csv ) <(csvtool namedcol Notes,Date /tmp/result.csv)