Or you can put the following script in your data directory as chg_id.pl. chmod the script to 755 and chmod the data directory to 777, and run the script:
Code:
#!/usr/bin/perl
# -------------------------------------------
require "../links.cfg";
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
$counter = 0;
$ENV{'REQUEST_METHOD'} and (print "Content-type: text/plain\n\n");
open (DB, "<$db_links_name")
or print "Unable to open links database 'links.db'. Reason: $!\n" and exit;
open (DBOUT, ">$db_script_path/data/links_new.db")
or print "Unable to open output database. Reason: $!\n" and exit;
LINE: while (<DB> ) {
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp; # Remove trailing new line.
$counter++;
@rec = &split_decode($_);
$rec[$db_key] = $counter;
print DBOUT &join_encode(&array_to_hash(0, @rec));
}
close DB;
close DBOUT;
open (DBID, ">$db_script_path/data/linksid_new.txt")
or print "Unable to open linksid.txt. Reason: $!" and exit;
print DBID $counter;
close DBID;
# ---------------------------------------------
You will now have a new file, links_new.db, in your data directory. Check it over to be sure everything worked. Then rename your links.db file to links_org.db (just in case you need to restore it) and rename links_new.db to links.db. You should now have a completely renumbered links database. You will also have a linksid_new.txt in the data directory. You should rename linksid.txt to linksid_org.txt and then rename linksid_new.txt to linksid.txt.
After you are satisfied that all is well, you can delete the links_org.db and linksid_org.txt files.
By the way, I would ensure that you have no records in validate.db or modified.db before doing this.
I hope this helps.
[This message has been edited by Bobsie (edited May 27, 1999).]