annotate postprocess_csv.sh @ 0:81b0ca76435d draft default tip

"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
author climate
date Thu, 30 Dec 2021 15:24:09 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
1 #!/usr/bin/env bash
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
2
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
3 WORKDIR=$1
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
4 RESDIR=$2
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
5
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
6 echo "===================================================================="
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
7 echo " Convert EODIE csv to tabular "
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
8 echo "===================================================================="
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
9
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
10 nb_csv=$(find $WORKDIR -type f -name "*.csv" | wc -l)
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
11 echo "Number of csv file to convert: $nb_csv"
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
12 if [[ $nb_csv -gt 0 ]]; then
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
13 echo "Start"
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
14 for infile in $WORKDIR/*.csv; do
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
15 echo "processing $infile"
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
16 sed -i.bak -e "s/,/\t/g" $infile
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
17 mv $infile $RESDIR/.
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
18 done
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
19 fi
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
20
81b0ca76435d "planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff changeset
21 echo "EODIE Tabular saved."