My BibTeX files contain references to files, like PDF files. I use the field "file" to indicate the referenced files. This is useful to associate files with a BibTeX entry. Moreover one can directly open the file from some software, such as JabRef. I would like to concatenate BibTeX files located in different folders and keep valid relative links. Valid links will allow to access the files from the concatenated BibTeX file.
A dummy command cat will lose all relative links.
Here is an example of what I except from the concatenation. Below are two BibTeX files located in two different folders. The field 'file' indicates the location of the referenced file. In the concatenated result file, these 'file' fields are modified to take into account the location of the files.
Root dir
|- RootA
| - A.bib
|- RootB
| - B.bib
with A.bib
@MISC{XY,
title = {John Doe's Book},
author = {John Doe},
file = {johnDoe.pdf:johnDoe.pdf:pdf},
}
with B.bib
@MISC{XX,
title = {Jane Doe's Book},
author = {Jane Doe},
file = {janeDoe.pdf:janeDoe.pdf:pdf},
}
I would like the concatenation of the two files to look like this:
@MISC{XY,
title = {John Doe's Book},
author = {John Doe},
file = {johnDoe.pdf:RootA/johnDoe.pdf:pdf},
}
@MISC{XX,
title = {Jane Doe's Book},
author = {Jane Doe},
file = {janeDoe.pdf:RootB/janeDoe.pdf:pdf},
}
The tools I have used so far do not do such things...
The basic idea I have to do this, is to use a combination of command lines tools such as sed and cut. But it seems painful and not robust. And I should also mention that one should make difference between absolute links and relative links. Finally, the result file depends on where we run the concatenation command...
Does anyone has a better idea, or know a software that performs that operation?