Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#399 closed defect (fixed)

postcode help

Reported by: steve@… Owned by: steve@…
Priority: minor Milestone:
Component: website Version:
Keywords: Cc:


the FTP stats page

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

is fine

Change History (2)

comment:1 Changed 13 years ago by edward@…

Resolution: fixed
Status: newclosed

curl|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"'

comment:2 Changed 13 years ago by edward@…

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"
Note: See TracTickets for help on using tickets.