0

I have a .bib file, but not all references are cited.

I want to list all cited (only) references in a .csv file.

But, the .bib file contains references that are not cited as well.

What I understood is, the .bbl file contains the cited references only.

So, how do I export the cited references to a .CSV file?

1
  • 1
    It might be easiest to use some other programming language to go through the two files. But in that case, I'm not sure it would be on topic for this site.
    – Teepeemm
    Jul 22, 2021 at 2:01

2 Answers 2

2

Depending on whether you are using biblatex or BibTeX, the .bbl file might not really lend itself to being read back by a machine if you want to recover all data. If you only want to recover which entries were cited and no additional data, that is less relevant.

The .bbl file produced for BibTeX bibliographies contains typesettable text and thus requires quite intricate parsing if you want to get back the entry data.

\begin{thebibliography}{1}
\bibitem[Elk(1972)]{elk}
Anne Elk.
\newblock \emph{A Theory on Brontosauruses}.
\newblock Monthy \& Co., 1972.

\end{thebibliography}

Since the style decides what gets written to the .bbl file, some data might be missing.

The .bbl file produced for biblatex contains entry data in a structured, LaTeX-readable format that could in theory be parsed to get back all entry data.

\refsection{0}
  \datalist[entry]{nyt/global//global/global}
    \entry{elk}{book}{}
      \name{author}{1}{}{%
        {{un=0,uniquepart=base,hash=6a9b0705c275273262103333472cc656}{%
           family={Elk},
           familyi={E\bibinitperiod},
           given={Anne},
           giveni={A\bibinitperiod},
           givenun=0}}%
      }
      \list{location}{1}{%
        {London}%
      }
      \list{publisher}{1}{%
        {Monthy \& Co.}%
      }
      \strng{namehash}{6a9b0705c275273262103333472cc656}
      \strng{fullhash}{6a9b0705c275273262103333472cc656}
      \strng{bibnamehash}{6a9b0705c275273262103333472cc656}
      \strng{authorbibnamehash}{6a9b0705c275273262103333472cc656}
      \strng{authornamehash}{6a9b0705c275273262103333472cc656}
      \strng{authorfullhash}{6a9b0705c275273262103333472cc656}
      \field{sortinit}{E}
      \field{sortinithash}{8da8a182d344d5b9047633dfc0cc9131}
      \field{extradatescope}{labelyear}
      \field{labeldatesource}{year}
      \field{labelnamesource}{author}
      \field{labeltitlesource}{title}
      \field{title}{A Theory on Brontosauruses}
      \field{year}{1972}
    \endentry
  \enddatalist
\endrefsection
\endinput

The .bbl file generated for biblatex will contain context-specific data that is only relevant within the current document context. This may or may not be wanted when you want to export the data to .csv.

But I would go down a different route. I would use one of the methods from Creating .bib file containing only the cited references of a bigger .bib file to generate a .bib file of only the cited references and would then use a library to read in the .bib file directly.

1
  • Thanks. The method suggested using JabRef worked fine for me.
    – Jaya A
    Jul 23, 2021 at 4:33
1

You can get a complete list of citations in your document from the .aux file. Each \cite command will cause an entry to be written in the .aux file in the format

\citation{REFNAME}

where REFNAME is the name you used in the \cite command. It will create a separate \citation command for each reference in a multi-reference \cite command, so if you, for example, typed \cite{foo,bar} in your document you will see

\citation{foo}
\citation{bar}

From here, you can do what you want to generate your CSV file, so if you're on a Unixish system (including MacOS and Linux), you can write

grep '\\citation` my.aux | sort | uniq

that will give you a list of all the reference names cited in your document with duplicates removed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .