Mercurial > repos > climate > eodie
annotate postprocess_csv.sh @ 0:5354615b21fc draft default tip
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
| author | climate |
|---|---|
| date | Thu, 30 Dec 2021 15:23:24 +0000 |
| parents | |
| children |
| rev | line source |
|---|---|
|
0
5354615b21fc
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff
changeset
|
1 #!/usr/bin/env bash |
|
5354615b21fc
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff
changeset
|
2 |
|
5354615b21fc
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff
changeset
|
3 WORKDIR=$1 |
|
5354615b21fc
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff
changeset
|
4 RESDIR=$2 |
|
5354615b21fc
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff
changeset
|
5 |
|
5354615b21fc
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff
changeset
|
6 echo "====================================================================" |
|
5354615b21fc
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff
changeset
|
7 echo " Convert EODIE csv to tabular " |
|
5354615b21fc
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff
changeset
|
8 echo "====================================================================" |
|
5354615b21fc
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff
changeset
|
9 |
|
5354615b21fc
"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) |
|
5354615b21fc
"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" |
|
5354615b21fc
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff
changeset
|
12 if [[ $nb_csv -gt 0 ]]; then |
|
5354615b21fc
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff
changeset
|
13 echo "Start" |
|
5354615b21fc
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff
changeset
|
14 for infile in $WORKDIR/*.csv; do |
|
5354615b21fc
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff
changeset
|
15 echo "processing $infile" |
|
5354615b21fc
"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 |
|
5354615b21fc
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff
changeset
|
17 mv $infile $RESDIR/. |
|
5354615b21fc
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff
changeset
|
18 done |
|
5354615b21fc
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff
changeset
|
19 fi |
|
5354615b21fc
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff
changeset
|
20 |
|
5354615b21fc
"planemo upload for repository https://gitlab.com/eetun-tiimi/EODIE commit c4a5672398bc878dd2bc0bf4f3a26f59b3f6395c"
climate
parents:
diff
changeset
|
21 echo "EODIE Tabular saved." |
