Revision 10891
Added by Aaron Marcuse-Kubitza over 11 years ago
BIEN2/country_species/run | ||
---|---|---|
1 |
#!/bin/bash -e |
|
2 |
. "$(dirname "${BASH_SOURCE[0]}")"/../../lib/runscripts/util.run |
|
3 |
.rel ../../lib/sh/db.sh |
|
4 |
|
|
5 |
# exports each BIEN2 country's species list |
|
6 |
|
|
7 |
if self_not_included; then |
|
8 |
|
|
9 |
all() |
|
10 |
{ |
|
11 |
echo_func; set_make_vars; deferred_check_target_exists |
|
12 |
|
|
13 |
if ! isset password; then |
|
14 |
local_export password; read -rsp 'Enter your MySQL password: ' password |
|
15 |
fi |
|
16 |
local_export database=bien_web table=country_species |
|
17 |
|
|
18 |
split $'\n' "$(query="SELECT DISTINCT country FROM $table" mysql_export|tail -n +2)" |
|
19 |
local countries=("${parts[@]}") |
|
20 |
|
|
21 |
local country; for country in "${countries[@]}"; do |
|
22 |
filter="country = '$country'" stdout="$top_dir/$country.tsv" to_file \ |
|
23 |
mysql_export |
|
24 |
done |
|
25 |
} |
|
26 |
|
|
27 |
fi |
|
0 | 28 |
Also available in: Unified diff
added BIEN2/country_species/run, which exports each BIEN2 country's species list