# Removing urls from bibliography, without editing .bst file [closed]

First of all, I have tried Disabling URLs in bibliography and it does not work.

Secondly, I am not repeating Suppress certain URLS in bibliography as I prefer to not edit the bib file, which is automatically generated.

I am preparing a conference publication to be submitted to IEEE; so, please don't suggest editing the bibliography style file (IEEEtran.bst).

I have a .bib file generated from Mendeley which contains url fields. Currently, I manually delete them. However, in favor of efficiency, I would like either

1. A way to export from Mendeley without urls

or

1. A way to disable insertion of url in the bibliography, preferrably via a directive or a flag

preferably both!

A minimal example [source.tex]

\documentclass[conference]{IEEEtran}

\begin{document}
\bstctlcite{MyBSTcontrol}
\title{I need a vacation!}
\author{\IEEEauthorblockN{tokyo coder}
\IEEEauthorblockA{Institute of Random Stuff, A big University, Japan}}
\maketitle
\IEEEpeerreviewmaketitle

\section{Introduction}
kill me now \cite{Levecque2017} \\does happiness exist?

\bibliographystyle{IEEEtran}
\bibliography{science,disabl_url}

% that's all folks
\end{document}


The bib file is [science.bib]

@article{Levecque2017,
author = {Levecque, Katia and Anseel, Frederik and {De Beuckelaer}, Alain and {Van der Heyden}, Johan and Gisle, Lydia},
doi = {http://dx.doi.org/10.1016/j.respol.2017.02.008},
isbn = {3907},
issn = {0048-7333},
journal = {Research Policy},
keywords = {GHQ-12,Mental health,PhD students,Psychosocial working conditions,Work organization},
number = {4},
pages = {868--879},
publisher = {Elsevier B.V.},
title = {{Work organization and mental health problems in PhD students}},
url = {http://www.sciencedirect.com/science/article/pii/S0048733317300422},
volume = {46},
year = {2017}
}


Second bib file is [disabl_url.bib]

@IEEEtranBSTCTL{MyBSTcontrol,
CTLuse_url = "no",
}


## closed as off-topic by gernot, Schweinebacke, Werner, user36296, clemensApr 25 '17 at 14:15

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

• I have no idea if Mendeley can suppress the url export. Regarding the tex side: Make a complete example so that one can test how the bbl looks like. – Ulrike Fischer Mar 17 '17 at 10:55
• Possible duplicate of Suppress certain URLS in bibliography – Chris H Mar 17 '17 at 11:12
• @ChrisH: This is not a duplicate to your question. Your question uses biblatex, but here a bst-file is used. – Ulrike Fischer Mar 17 '17 at 11:59
• Possible duplicate of Disabling URLs in bibliography – user36296 Mar 17 '17 at 13:14
• I'm voting to close this question as off-topic because it caused by an outdated package version. – Schweinebacke Apr 25 '17 at 9:59

Get a recent copy of IEEEtran.bst from CTAN, at least Version 1.14 (2015/08/26). Then proceed as described in Disabling URLs in bibliography.
One way to do this is to automatically edit the .bib file to remove the url field. After exporting your file from mendeley, you would need to delete all lines starting url (with possible whitespace first), writing to a new .bib file (as your master bibliography is in mendeley you could overwrite the original but in the general case I don't suggest you do). This is easily done on the commandline using sed (available on all unix-like systems, including mac, also possible on windows by using Cygwin or MinGW, or just installing it). Any decent programmer's text editor will also provide a way to do the same thing (regex find/replace).
The command you actually need is sed 's/^\s*url.*,//' bibliography.bib >temp.bib, which breaks down to run sed to substitute (s/) from the beginning of the line (^) one or more (*) whitespace characters (\s) followed by "url", and one or more (*) of any character except newline (.) up to a comma. The replacement is blank (given by the // as / is the delimiter). This leaves a blank line where the url was, but bibtex won't mind.
If the url is the last item in the entry, with no comma at the end of the line, this won't work. So if mendeley (I tried it once and never used it again) puts the url last in the entry, we'll need a slightly different replacement, which will depend on whether the final closing } of the entry is on its own line or on the same line as the url. A more complex regex could take these variables into account, but I find it that it's better to keep things simple as there's less to go wrong.