Last active
March 23, 2020 13:18
-
-
Save SamStudio8/475f6daeca0db76521d043af29706cbd to your computer and use it in GitHub Desktop.
Generate a list of UK authorities
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm counties.* | |
rm *csv | |
# England ###################################################################### | |
curl -O -J -L https://www.registers.service.gov.uk/registers/local-authority-eng/download-csv | |
# https://www.datadictionary.nhs.uk/data_dictionary/nhs_business_definitions/l/local_authority_de.asp? | |
# A Local Authority, in relation to England is: | |
## a County Council | |
awk -F',' '$6=="CTY" {print $7}' local-authority-eng.csv >> counties.eng.ls | |
## a District Council | |
awk -F',' '$6=="DIS" {print $7}' local-authority-eng.csv >> counties.eng.ls | |
## a London Borough Council | |
awk -F',' '$6=="LBO" {print $7}' local-authority-eng.csv >> counties.eng.ls | |
## the Common Council of the City of London in its capacity as a Local Authority | |
awk -F',' '$6=="CC" {print $7}' local-authority-eng.csv >> counties.eng.ls | |
## the Council of the Isles of Scilly | |
# Included as UA | |
## a Unitary Authority | |
awk -F',' '$6=="UA" {print $7}' local-authority-eng.csv >> counties.eng.ls | |
## add the combined authorities i guess? | |
awk -F',' '$6=="COMB" {print $7}' local-authority-eng.csv >> counties.eng.ls | |
sed 's,",,g' counties.eng.ls | sort | uniq | sed 's,^,UK-ENG\t,' > counties.ls | |
# Scotland ###################################################################### | |
curl -O -J -L https://www.registers.service.gov.uk/registers/local-authority-sct/download-csv | |
# All Scottish council areas | |
awk -F',' '$6=="CA" {print $7}' local-authority-sct.csv >> counties.sct.ls | |
sed 's,",,g' counties.sct.ls | sort | sed 's,^,UK-SCT\t,' >> counties.ls | |
# Wales ######################################################################## | |
curl -O -J -L https://www.registers.service.gov.uk/registers/principal-local-authority/download-csv | |
# All Welsh PLA | |
tail -n+2 principal-local-authority.csv | cut -f6 -d',' >> counties.wls.ls | |
sed 's,",,g' counties.wls.ls | sort | sed 's,^,UK-WLS\t,' >> counties.ls | |
# Northern Ireland ############################################################ | |
curl -O -J -L https://www.registers.service.gov.uk/registers/local-authority-nir/download-csv | |
# 11 NIR districts | |
tail -n+2 local-authority-nir.csv | awk -F',' '$6 != "" { print $7 }' >> counties.nir.ls | |
sed 's,",,g' counties.nir.ls | sort | sed 's,^,UK-NIR\t,' >> counties.ls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment