I have a large text file (.bib) with lots of double entries for some fields. Essentially, the file is a .bib
-file (more info here) which has roughly 1000 entries. The content is structured like this:
@Article{Apak_2011_Financialriskmanagement,
Title = {Financial risk management in renewable energy sector: Comparative analysis between the European Union and Turkey},
Author = {Apak, Sudi and Atay, Erhan and Tuncer, Güngör},
Journal = {Procedia - Social and Behavioral Sciences},
Pages = {935--945},
Volume = {24},
Year = {2011},
Doi = {10.1016/j.sbspro.2011.09.013},
ISSN = {1877-0428},
}
@Incollection{Berger_1992_OutputMeasurementin,
Title = {Output Measurement in the Service Sectors},
Author = {Berger, Allen N. and Humphrey, David B.},
Crossref = {Griliches_1992_OutputMeasurementinb},
Pages = {245--300 book},
Year = {1992},
Publisher = {University of Chicago Press},
Date = {1992-10-04},
Booktitle = {Output Measurement in the Service Sectors},
Editor = {Griliches, Zvi and Berndt, Ernst R. and Bresnahan, Timothy F. and Manser, Marilyn}
}
@Book{Bogenstahl_2012_ManagementvonNetzwerken,
Title = {Management von Netzwerken},
Author = {Bogenstahl, Christoph},
Publisher = {Gabler},
Date = {2012-01-01},
ISBN = {978-3-8349-3572-4},
Series = {Strategisches Kompetenz-Management}
}
You'll see that there is only Year
defined for the first source. The second source however, has both Year
and Date
defined.
EDIT: HINDSIGHT IS 20/20
I just noticed that I always need the Year
field because I manage the whole file via JabRef. And for generating a bibtex-key, JabRef needs the Year
-field. I mean I haven't found an option to generate the bibtex-key with the help of the yyyy
-part of the Date
-field so far, so I'll edit the conditions.
So, is there a way to do the following actions:
- If there is only
Date
defined for a source entry, copy the first 4 digits (yyyy) toYear
. - If there is only
Year
defined, copy the four digits toDate
. - If there is both
Date
andYear
defined, do nothing.
Now following are the old conditions, when I hadn't thought of JabRef's inner workings beforehand
Old conditions, still relevant if one would like to prepare the .bib-file for the use with biblatex and has a mixup of the Date
and Year
field in his file:
- If there is only
Date
defined for an source entry, do nothing. - If there is both
Date
andYear
defined, copy the content of the brackets forDate
into the brackets forYear
. The catch here is,Date
might contain more information (by the format yyyy-mm-dd) thanYear
, so this is exactly why I am writing down these "conditions". Regardless of the contents ofYear
,Date
is more important. Unless I made some errors while typing all the info in, the first 4 digits ofDate
should be equal toYear
of course. - If there is only
Year
defined, the termYear
can be simply replaced withDate
.
A few notes:
If this info could be of any help in this case: I use Windows 7 and Xubuntu 14.04. I have Office 2010, if that could be used here... or I could gladly use some sort of tool on Xubuntu, I don't know.
I checked already and apparently I can't use JabRef for this, it's a bit too complicated.
Date
to be copied toYear
. What if the date contains more than just a year? Should month and day of month be copied too?Year
,Date
is more important. Unless I made some errors while typing all the info in, the first 4 digits ofDate
should be equal toYear
of course. :)