Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

postcode help #399

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 2 comments
Closed

postcode help #399

openstreetmap-trac opened this issue Jul 23, 2021 · 2 comments

Comments

@openstreetmap-trac
Copy link

Reporter: steve[at]fractalus.com
[Submitted to the original trac issue database at 8.02pm, Wednesday, 28th March 2007]

the FTP stats page

http://www.freethepostcode.org/stats.html

lists '9 inner parts to be found for NW1' type stats. I have a request that it should say 'NW1 needs inner parts for NW1 1, NW1 2, NW1 9 but they may not exist'. Across all postcodes. A bit of perl or something which parses

http://www.freethepostcode.org/currentlist

is fine

@openstreetmap-trac
Copy link
Author

Author: edward[at]debian.org
[Added to the original trac issue at 3.22pm, Friday, 30th March 2007]

curl http://www.freethepostcode.org/currentlist|perl -ne'/ ([A-Z0-9]+) (\d)[A-Z0-9]+/and$p{$1}{$2}=1}for$o(sort keys%p){@i=grep!$p{$o}{$_},1..9;@i and print"$o needs inner parts for ",join(", ",map"$o $_",@i)," but they may not exist\n"'

@openstreetmap-trac
Copy link
Author

Author: edward[at]debian.org
[Added to the original trac issue at 3.33pm, Friday, 30th March 2007]

or slightly less cryptically:

use strict;
use warnings;

my %postcode;
/ ([A-Z0-9]+) (\d)[A-Z0-9]+/ and $postcode{$1}{$2} = 1 while <>;
foreach my $outer (sort keys %postcode) {
    my inner = grep !$postcode{$outer}{$_}, 1..9 or next;
    print "$outer needs inner parts for ",
        join(", ", map "$outer $_", inner),
        " but they may not exist\n"
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant