Skip to content

Commit

Permalink
Uniq in subdivision table
Browse files Browse the repository at this point in the history
  • Loading branch information
sabas committed Feb 16, 2024
1 parent b65f2e1 commit 750e861
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
3 changes: 0 additions & 3 deletions data/subdivision-codes.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1756,7 +1756,6 @@ IN,HP,Himāchal Pradesh
IN,HR,Haryāna
IN,JH,Jhārkhand
IN,JK,Jammu and Kashmīr
IN,JK,Jammu and Kashmīr
IN,KA,Karnātaka
IN,KL,Kerala
IN,LA,Ladākh
Expand Down Expand Up @@ -2450,7 +2449,6 @@ MA,CAS,Casablanca [Dar el Beïda]*
MA,CHE,Chefchaouene
MA,CHI,Chichaoua
MA,CHT,Chtouka-Ait Baha
MA,CHT,Chtouka-Ait Baha
MA,DRI, Driouch
MA,ERR,Errachidia
MA,ESI,Essaouira
Expand Down Expand Up @@ -2640,7 +2638,6 @@ MK,202,Vinica
MK,203,Delčevo
MK,204,Zrnovci
MK,205,Karbinci
MK,205,Karbinci
MK,206,Kočani
MK,207,Makedonska Kamenica
MK,208,Pehčevo
Expand Down
2 changes: 1 addition & 1 deletion datapackage.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "un-locode",
"title": "UN-LOCODE Codelist",
"version": "2023.2.0",
"version": "2023.2.1",
"licenses": [
{
"name": "ODC-PDDL-1.0",
Expand Down
3 changes: 2 additions & 1 deletion scripts/prepare_edition.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ done
gawk -v RS='"[^"]*"' -v ORS= '{gsub(/\n/, " ", RT); print $0 RT}' mdb_SubdivisionCodes_out.csv > subdivision-codes.tmp.csv
sed -i 's/ \{2,\}/ /g;s/[[:blank:]]*$//' subdivision-codes.tmp.csv
sed -i 's/\t/ /g' subdivision-codes.tmp.csv
uniq subdivision-codes.tmp.csv > subdivision-codes.tmp2.csv

gawk -v RS='"' 'NR % 2 == 0 { gsub(/\n/, "") } { printf("%s%s", $0, RT) }' "mdb_${filename}_out.csv" > code-list.tmp.csv #remove newlines in data
csvgrep -c 3 -r "^$" -i code-list.tmp.csv > code-list.tmp2.csv #remove country headers
Expand All @@ -22,5 +23,5 @@ mv code-list.csv data/code-list.csv
mv mdb_CountryCodes_out.csv data/country-codes.csv
mv mdb_FunctionClassifiers_out.csv data/function-classifiers.csv
mv mdb_StatusIndicators_out.csv data/status-indicators.csv
mv subdivision-codes.tmp.csv data/subdivision-codes.csv
mv subdivision-codes.tmp2.csv data/subdivision-codes.csv
rm *.csv

0 comments on commit 750e861

Please sign in to comment.