我有一个(大型)bibtex 数据库,如下所示。我需要将 DOI 字段添加到每个条目中。这个新字段只是 URLDOI 的副本,但没有 URL 和“http://dx.doi.org/“(参见第二段代码)。有没有什么方法(=工具、代码等)可以自动完成(或类似的事情)?谢谢!
原始条目数据库:
@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},
}
改成:
@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},
}
答案1
根据@Andrew的评论,我给出了一个解决方案。使用像Vim这样的编辑器(在我的情况下是VimR),我使用以下命令:
:%s/urldoi = {http:\/\/dx.doi.org\/\([^}]*\)}\,$/&\r doi = {\1},/