Renaming file, adapting scripts

This commit is contained in:
Sebastien Laithier 2019-08-09 14:09:17 +02:00
parent bd8d441ef0
commit 12a72a3dd6
3 changed files with 6 additions and 6 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
FILE_RANGE="./temp.txt" FILE_RANGE="./source/range-country_code.txt"
FILE_COUNTRY_CODE="./GeoLite2-Country-CSV_20190806/GeoLite2-Country-Locations-fr.csv" FILE_COUNTRY_CODE="./source/GeoLite2-Country-CSV_20190806/GeoLite2-Country-Locations-fr.csv"
CODE=0 CODE=0
while read p; do while read p; do
@ -28,4 +28,4 @@ while read p; do
printf "%s %s\n" "$RANGE" "$CONTINENT" >> NA.txt printf "%s %s\n" "$RANGE" "$CONTINENT" >> NA.txt
;; ;;
esac esac
done < temp.txt done < $FILE_RANGE

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
FILE_RANGE="./temp.txt" FILE_RANGE="./source/range-country_code.txt"
FILE_COUNTRY_CODE="./GeoLite2-Country-CSV_20190806/GeoLite2-Country-Locations-fr.csv" FILE_COUNTRY_CODE="./source/GeoLite2-Country-CSV_20190806/GeoLite2-Country-Locations-fr.csv"
CODE=0 CODE=0
while read p; do while read p; do
@ -9,4 +9,4 @@ while read p; do
RANGE=$(awk -F ',' '{print $1}' <<< $p) RANGE=$(awk -F ',' '{print $1}' <<< $p)
COUNTRY=$(awk -v country_code="$CODE" -F ',' '$0 ~ country_code {print $5}' $FILE_COUNTRY_CODE) COUNTRY=$(awk -v country_code="$CODE" -F ',' '$0 ~ country_code {print $5}' $FILE_COUNTRY_CODE)
printf "%s\n" "$RANGE" >> ./country/"$COUNTRY".txt printf "%s\n" "$RANGE" >> ./country/"$COUNTRY".txt
done < temp.txt done < $FILE_RANGE