0

I have a (big) bibtex database like I show below. I need to add the DOI field to every entry. This new field is just a copy of URLDOI, but without URL and "http://dx.doi.org/" (see the second piece of code) . Is there any way (= tool, code, etc) to do automatically (or something similar)? Thanks!

Original database of entries:

@article{xxxAl:2016,
  author = {authors},
  title = {title},
  journal = {journal},
  year = 2016,
  pages = {19:1--19:69},
  publisher = oxford,
  urldoi = {http://dx.doi.org/10.1017/S2956796816000162},
  volume = 26,
  month = sep,
}

@inproceedings{2016,
  author = {authors2},
  title = {title2},
  pages = {298--310},
  urldoi = {http://dx.doi.org/10.1145/2951913.2951933},
} 

change to:

@article{xxxAl:2016,
  author = {authors},
  title = {title},
  journal = {journal},
  year = 2016,
  pages = {19:1--19:69},
  publisher = oxford,
  urldoi = {http://dx.doi.org/10.1017/S2956796816000162},
  doi = {10.1017/S2956796816000162},
  volume = 26,
  month = sep,
}

@inproceedings{2016,
  author = {authors2},
  title = {title2},
  pages = {298--310},
  urldoi = {http://dx.doi.org/10.1145/2951913.2951963},
  doi = {10.1145/2951913.2951963},
}   
4
  • This is not really a latex question and can, instead, be done with any editor that accepts regular expressions. For example, you could do this with vim using :%s/urldoi = {http:\/\/dx.doi.org\/\([^}]*\)}\,$/&^M doi = {\1},/. (Any existing doi entries would be doubled.) – user30471 Jul 30 '18 at 5:44
  • Thanks a lot!!, I am looking for this kind of solution! I used the solution with VimR (for MacOSX). I only have issue with the solution. Is it possible to replace ^M with a break line ("intro" key)? Because when I now apply the solution I get urldoi ={http://dx.doi.org/10.1016/j.cl.2003.09.002},^M doi = {10.1016/j.cl.2003.09.002},. Thanks! – Naive Developer Jul 30 '18 at 13:00
  • I just replaced ^M with \r, thanks! – Naive Developer Jul 30 '18 at 13:14
  • The ^M is a new line character. You need to input it as <cmd>-V<return> - or use \r:) – user30471 Jul 30 '18 at 23:51
0

Following the comment of @Andrew, I give a solution. Using an editor like Vim (in my case VimR), I use the following command:

:%s/urldoi = {http:\/\/dx.doi.org\/\([^}]*\)}\,$/&\r doi = {\1},/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.