bibtex, perl, programming, scripts

Endnote to BibTeX

If you export from and Endnote Library that has author names in the format A.B.C.Surname then BibTeX won’t interpret the author names properly. I have uploaded a little perl script that opens a .bib file and substitutes the names into ‘A B C Surname’ format. Code is below and script can be downloaded here.


#!/usr/bin/perl -w
my @bibfile;
my $file = $ARGV[0];
my @filename = split(/\./, $file);
my $filestem = $filename[0];

open( INPUT, "<$file" );

@bibfile = <INPUT>; # put each line into an array

close(INPUT);

my $prefix="edit";
my $outputBIBfile = "$filestem.$prefix.bib";

open( BIBOUTPUT, "> $outputBIBfile");

foreach(@bibfile){

if ($_ =~ /Author/){

$_ =~ s/\./ /g;

}

print BIBOUTPUT "$_";

}

close( BIBOUTPUT );

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s