Skip to content

Instantly share code, notes, and snippets.

@jbarrett
Created August 8, 2021 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbarrett/73fd3dd45d7bcacce5bf3d88fe2654bc to your computer and use it in GitHub Desktop.
Save jbarrett/73fd3dd45d7bcacce5bf3d88fe2654bc to your computer and use it in GitHub Desktop.
Fix URLs in Mendeley's BibTeX export
#!/usr/bin/env perl
use IO::All -utf8;
my $in = 'library.bib';
my $out = 'library-munged.bib';
my @lines = io($in)->slurp;
for my $url ( grep { /^url/ } @lines ) {
$url =~ s/\{\\([_\%~&#])\}/\\$1/g;
$url =~ s/\{~\}/~/g;
}
io($out)->print(@lines);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment