#!/usr/bin/perl # # BDB (Bibtex DataBase) --- use BibTeX to convert databases to anything. # # get command line arguments $input = shift; if(!$input){ print "\n usage: bdb database[.bib] style[.bst]\n\n"; exit(1); } $style = shift; if(!$style){ print "\n usage: bdb database[.bib] style[.bst]\n\n"; exit(1); } # chop extensions: $input =~ s/\.bib//; $style =~ s/\.bst//; $tmpname = "/tmp/bdb"; open AUXFILE, ">$tmpname.aux"; print AUXFILE " \\citation{*} \\bibstyle{$style} \\bibdata{$input} "; close AUXFILE; system("bibtex $tmpname"); system("cp $tmpname.bbl $input.bbl"); print "converted $input.bib --> $input.bbl using $style.bst\n";