Subversion Repositories eFlore/Applications.cel

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1774 raphael 1
#!/bin/bash
2
 
3
orig=/tmp/orig.csv
4
ret=${1:-/tmp/result.csv}
5
 
6
# curl -sF "upload=@test.xls" -F utilisateur=22506 "http://cel/jrest/ImportXLS"
7
# $ sqlite3 .mozilla/firefox/*.default/cookies.sqlite<<<"SELECT * FROM moz_cookies WHERE baseDomain = 'cel' AND name = 'PHPSESSID';"
8
# GET -H "Cookie: PHPSESSID=ID" "http://cel/jrest/CelWidgetExport/export/?colonnes=standard,avance,etendu,baseflor&id_utilisateur=22506&format=csv > $ret
9
[[ ! -f $ret || ! -f test.xls ]] && echo "err" && exit 1
10
 
11
[[ ! -f $orig ]] && xls2csv -s cp1252 test.xls 2>/dev/null > $orig
12
[[ ! -f $orig ]] && echo "err" && exit 1
13
 
14
 
15
IFS=$'\n' cols=( $(csvtool head 1 $orig|tr , "\n") )
16
 
17
# test header
18
#diff <(csvtool head 1 $orig|tr , "\n") <(csvtool head 1 $ret |tr , "\n"); exit;
19
 
20
w=$(csvtool width $ret); w=32
21
 
22
# wdiff <(xls2csv -s cp1252 test.xls|csvtool readable -) <(csvtool readable $ret)
23
for i in ${cols[@]}; do
24
	[[ $i =~ ^(Date Transmission|Date Création|Date Modification|Nom Commun|Identifiant|Ordre)$ ]] && continue;
25
	echo "== $i";
26
	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)
27
done
28
 
29
 
30
#ddiff <(csvtool namedcol Notes,Date /tmp/orig.csv ) <(csvtool namedcol Notes,Date /tmp/result.csv)