my %opt;
-if ( !getopts("cdm:v:ijfq", \%opt ) ) {
+if ( !getopts("cdm:v:ijfqh:", \%opt ) ) {
print STDERR <<EOF;
usage: $0 [-c|-d] [-m num] [-v|-v level] [-i|-j|-f]
-c create database on first use
-d delete database before import
-m num import just num increments for one host
+ -h "h1 h2" import just single HostList hosts
-v num set verbosity (debug) level (default $debug)
-i update Hyper Estraier full text index
-j update full text, don't check existing files
my @hosts = keys %{$hosts};
my $host_nr = 0;
+my $host_regex;
+if ( exists $opt{h} ) {
+ $host_regex = $opt{h};
+ $host_regex =~ s/\s+/|/g;
+ $host_regex = '^' . $host_regex . '$';
+}
+
foreach my $host_key (@hosts) {
my $hostname = $hosts->{$host_key}->{'host'} || die "can't find host for $host_key";
- $sth->{hosts_by_name}->execute($hosts->{$host_key}->{'host'});
+ next if $host_regex && $hostname =~ m/$host_regex/;
+
+ $sth->{hosts_by_name}->execute($hostname);
unless (($hostID) = $sth->{hosts_by_name}->fetchrow_array()) {
$sth->{insert_hosts}->execute(