Version 1.0
-ajout d’un nouveau champ dans la table pour faire des recherches sans accent (bashbird et insert) -refonte de l’export markdown
This commit is contained in:
Binary file not shown.
2080
Oiseaux_europe.csv
2080
Oiseaux_europe.csv
File diff suppressed because it is too large
Load Diff
BIN
Transparent300px.png
Normal file
BIN
Transparent300px.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 100 B |
51
bashbirds.sh
51
bashbirds.sh
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
VERSION="v0.8"
|
VERSION="v1.0"
|
||||||
|
|
||||||
red="\033[1;31m"
|
red="\033[1;31m"
|
||||||
greenbold="\033[1;32m"
|
greenbold="\033[1;32m"
|
||||||
@@ -56,7 +56,9 @@ req2() {
|
|||||||
|
|
||||||
#read -p "Pause: " choice
|
#read -p "Pause: " choice
|
||||||
|
|
||||||
query2="SELECT * FROM liste;"
|
|
||||||
|
#query2="SELECT * FROM liste;"
|
||||||
|
query2="SELECT Francais, Autres, Latin, Anglais, Ordre, Famille, Liens FROM liste;"
|
||||||
result2=$(sqlite3 ./birds.db "$query2")
|
result2=$(sqlite3 ./birds.db "$query2")
|
||||||
#echo "$result2"
|
#echo "$result2"
|
||||||
|
|
||||||
@@ -72,6 +74,11 @@ req2() {
|
|||||||
or="${array[4]}"
|
or="${array[4]}"
|
||||||
fa="${array[5]}"
|
fa="${array[5]}"
|
||||||
ln="${array[6]}"
|
ln="${array[6]}"
|
||||||
|
|
||||||
|
|
||||||
|
#echo "$ln"
|
||||||
|
#read -r -p "Would you like to update? y/[n]: " SelfUpdate
|
||||||
|
|
||||||
[[ $aut != "" ]] && z="($aut)" || z=""
|
[[ $aut != "" ]] && z="($aut)" || z=""
|
||||||
|
|
||||||
if [ $ext = ".md" ]; then
|
if [ $ext = ".md" ]; then
|
||||||
@@ -85,14 +92,15 @@ req2() {
|
|||||||
#echo "| $ln |" >> "$f"
|
#echo "| $ln |" >> "$f"
|
||||||
#echo "" >> "$f"
|
#echo "" >> "$f"
|
||||||
|
|
||||||
bird+="| $fr $z |\n"
|
birds+="| $fr | $z |"'\n'
|
||||||
bird+="|--------------------------------------------------|\n"
|
birds+="|------------------------ | --------------------------|"'\n'
|
||||||
bird+="| $lat |\n"
|
birds+="| Vernaculaire | $lat |"'\n'
|
||||||
bird+="| $en |\n"
|
birds+="| Anglais | $en |"'\n'
|
||||||
bird+="| $or |\n"
|
birds+="| Ordre | $or |"'\n'
|
||||||
bird+="| $fa |\n"
|
birds+="| Famille | $fa |"'\n'
|
||||||
bird+="| $ln |\n"
|
#birds+="| Liens (oiseaux.net)<br /> | [$fr]($ln)<br /> |"'\n'
|
||||||
bird+=" \n"
|
birds+="| Liens (oiseaux.net)<br /> | [$fr]($ln)<br /> |"'\n'
|
||||||
|
birds+='\n'
|
||||||
|
|
||||||
elif [ $ext = ".html" ]; then
|
elif [ $ext = ".html" ]; then
|
||||||
|
|
||||||
@@ -132,7 +140,8 @@ req2() {
|
|||||||
elif [ $ext = ".md" ]; then
|
elif [ $ext = ".md" ]; then
|
||||||
|
|
||||||
echo -e "${yellow}Exporting markdown file...${reset}"
|
echo -e "${yellow}Exporting markdown file...${reset}"
|
||||||
echo "$bird" > "liste_oiseaux$ext"
|
bird=$(echo "$birds" | sed 's/\
|
||||||
|
//g')
|
||||||
echo -e "$bird" > "liste_oiseaux$ext"
|
echo -e "$bird" > "liste_oiseaux$ext"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -242,11 +251,9 @@ req1() {
|
|||||||
if [[ "${request,,}" == "all" ]]; then
|
if [[ "${request,,}" == "all" ]]; then
|
||||||
request="";
|
request="";
|
||||||
fi
|
fi
|
||||||
# COLLATE NOCASE, COLLATE UNICODE
|
|
||||||
# SELECT column FROM table WHERE UNICODE(column) = UNICODE('café');
|
request=$(echo "$request" | sed 'y/áàâäçéèêëîïìôöóùúüñÂÀÄÇÉÈÊËÎÏÔÖÙÜÑ/aaaaceeeeiiiooouuunAAACEEEEIIOOUUN/')
|
||||||
query1="SELECT * FROM liste WHERE Francais LIKE \"%$request%\" OR Autres LIKE \"%$request%\" OR Latin LIKE \"%$request%\" COLLATE NOACCENTS";
|
|
||||||
#query1="SELECT * FROM liste WHERE UNICODE(Francais) = UNICODE('$request')"; # OR Autres LIKE \"%$request%\" OR Latin LIKE \"%$request%\"";
|
|
||||||
echo "$query1"
|
|
||||||
query1="SELECT * FROM liste WHERE Fra LIKE \"%$request%\" OR Aut LIKE \"%$request%\" OR Latin LIKE \"%$request%\"";
|
query1="SELECT * FROM liste WHERE Fra LIKE \"%$request%\" OR Aut LIKE \"%$request%\" OR Latin LIKE \"%$request%\"";
|
||||||
result1=$(sqlite3 ./birds.db "$query1")
|
result1=$(sqlite3 ./birds.db "$query1")
|
||||||
|
|
||||||
@@ -256,12 +263,12 @@ req1() {
|
|||||||
cmpt=1
|
cmpt=1
|
||||||
while IFS='|' read -ra array2;
|
while IFS='|' read -ra array2;
|
||||||
do
|
do
|
||||||
aut2="${array2[1]}"
|
fr2="${array2[0]}"
|
||||||
lat2="${array2[2]}"
|
aut2="${array2[2]}"
|
||||||
en2="${array2[3]}"
|
lat2="${array2[4]}"
|
||||||
or2="${array2[4]}"
|
en2="${array2[5]}"
|
||||||
fa2="${array2[5]}"
|
or2="${array2[6]}"
|
||||||
lnk2="${array2[6]}"
|
fa2="${array2[7]}"
|
||||||
lnk2="${array2[8]}"
|
lnk2="${array2[8]}"
|
||||||
|
|
||||||
tag2="$fr2"
|
tag2="$fr2"
|
||||||
|
|||||||
22
insert.sh
22
insert.sh
@@ -13,8 +13,8 @@ reset="\033[0m"
|
|||||||
dir=$(dirname "$0") # /Users/bruno/Documents/Scripts/keywords2insta
|
dir=$(dirname "$0") # /Users/bruno/Documents/Scripts/keywords2insta
|
||||||
|
|
||||||
if [ ! -f ./birds.db ]; then
|
if [ ! -f ./birds.db ]; then
|
||||||
cmd0="CREATE TABLE liste (Francais string, Autres string, Latin string, Anglais string, Ordre string, Famille string, Liens string);"
|
cmd0="CREATE TABLE liste (Francais string, Fra string, Autres string, Aut string, Latin string, Anglais string, Ordre string, Famille string, Liens string);"
|
||||||
echo "$cmd0" | sqlite3 ./birds_plus.db
|
echo "$cmd0" | sqlite3 ./birds.db
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then exit 0; fi
|
if [ $? -ne 0 ]; then exit 0; fi
|
||||||
fi
|
fi
|
||||||
@@ -34,20 +34,24 @@ if [ -f "$dir"/Oiseaux_europe.csv ]; then
|
|||||||
((skip_headers--))
|
((skip_headers--))
|
||||||
else
|
else
|
||||||
fr="${array[0]}"
|
fr="${array[0]}"
|
||||||
aut="${array[1]}"
|
fr_wa="${array[1]}"
|
||||||
lat="${array[2]}"
|
aut="${array[2]}"
|
||||||
en="${array[3]}"
|
aut_wa="${array[3]}"
|
||||||
or="${array[4]}"
|
lat="${array[4]}"
|
||||||
fa="${array[5]}"
|
en="${array[5]}"
|
||||||
ln="${array[6]}"
|
or="${array[6]}"
|
||||||
|
fa="${array[7]}"
|
||||||
|
ln="${array[8]}"
|
||||||
|
|
||||||
fr=$(echo "$fr" | sed "s/'/''/g")
|
fr=$(echo "$fr" | sed "s/'/''/g")
|
||||||
|
fr_wa=$(echo "$fr_wa" | sed "s/'/''/g")
|
||||||
aut=$(echo "$aut" | sed "s/'/''/g")
|
aut=$(echo "$aut" | sed "s/'/''/g")
|
||||||
|
aut_wa=$(echo "$aut_wa" | sed "s/'/''/g")
|
||||||
en=$(echo "$en" | sed "s/'/''/g")
|
en=$(echo "$en" | sed "s/'/''/g")
|
||||||
or=$(echo "$or" | sed "s/'/''/g")
|
or=$(echo "$or" | sed "s/'/''/g")
|
||||||
fa=$(echo "$fa" | sed "s/'/''/g")
|
fa=$(echo "$fa" | sed "s/'/''/g")
|
||||||
|
|
||||||
cmd1="INSERT INTO liste (Francais, Autres, Latin, Anglais, Ordre, Famille, Liens) VALUES ('$fr','$aut','$lat','$en','$or','$fa','$ln');"
|
cmd1="INSERT INTO liste (Francais, Fra, Autres, Aut, Latin, Anglais, Ordre, Famille, Liens) VALUES ('$fr','$fr_wa','$aut','$aut_wa','$lat','$en','$or','$fa','$ln');"
|
||||||
echo "$cmd1" | sqlite3 ./birds.db
|
echo "$cmd1" | sqlite3 ./birds.db
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user