If I understand right, you simply want to reset the link numbers? If so, this should suffice:
Code:
#!/usr/local/bin/perl
require "links.cfg";
my ($i, $new);
open (OLD, "$db_lib_path/data/links.db") or die "Reason: $!";
while () {
my ($line, $id, $jumk);
chomp ($line = <OLD>);
last if !$line;
$i++;
($id, $junk) = split /\|/, $line, 2;
$new .= "$i|$junk\n";
}
close (OLD);
open (NEW, ">$db_lib_path/data/new.db") or die "Reason: $!";
print NEW $new;
close (NEW);
open (ID, ">$db_lib_path/data/linksid.txt") or die "Reason: $!";
print ID $i;
close (ID);
print "Content-type: text/plain\n\n";
print "New database saved as new.db and linksid.txt has been updated.";
You could update urls.db with this script to, but since Links regenerates this file on each rebuild, it's not necesary.
Happy Coding,
--Drew
http://www.FindingHim.com