2

I'd like to convert all cite keys in a large bibtex file to lower case. I tried to modify the "Downcase Titles" apple script in bibdesk, but I can't even get the original script to work. When I select a reference and run the script it returns the apple script error "(null)". Do I need to install any dependencies before I can run that script?

Assuming that I can get 'Downcase Titles' to work, can I just substitute the two instances of title with cite key in the following line to get it to convert the cite keys then?

set title of thePub to uncapitalize(title of thePub)

If there's a different way to convert cite keys in a .bib file, that would be fine too, it doesn't have to be bibdesk, this is a one-off need

3

if sample.bib is

@inproceedings{Zaaaa,
  title = {zzzz}
  booktitle = {Zzzz zzz }
  author = {foo,bar and ggg}
  date = {2000},
  pages = {13--1},
}

@misc{ABC,
  title = {zzzz}
  booktitle = {Zzzz zzz }
  author = {foo,bar and ggg}
  date = {2000},
  pages = {13--1},
}

@book{Zaabha,
  title = {zzzz}
  booktitle = {Zzzz zzz }
  author = {foo,bar and ggg}
  date = {2000},
  pages = {13--1},
}

then the following call to sed on the commandline produces:

$ sed  -e 's/\(@[a-zA-Z]*{\)\([^,]*\),/\1\L\2,/'  sample.bib 
@inproceedings{zaaaa,
  title = {zzzz}
  booktitle = {Zzzz zzz }
  author = {foo,bar and ggg}
  date = {2000},
  pages = {13--1},
}

@misc{abc,
  title = {zzzz}
  booktitle = {Zzzz zzz }
  author = {foo,bar and ggg}
  date = {2000},
  pages = {13--1},
}

@book{zaabha,
  title = {zzzz}
  booktitle = {Zzzz zzz }
  author = {foo,bar and ggg}
  date = {2000},
  pages = {13--1},
}

The above is using Gnu Sed, you may prefer to use perl to get the same output

perl  -pe 's/(@[a-zA-Z0-9:]*{)([^,]*),/$1\L$2,/'  sample.bib 

Note the above just alters the main keys for each entry If there are internal cross references within the bib file you will want to lowercase those as well to keep the bib file being consistent, something like

sed -e 's/(\scrossref = )(\{[A-Za-z0-9:]*\})/\1\L\2/' sample.bib
9
  • The OP is using a Mac, and the BSD sed is kind of crappy. So this unfortunately doesn't work; it prefixes L to each key.
    – Alan Munn
    May 10 at 19:39
  • @AlanMunn I'm sure gnu sed is available? (or would perl be better?) May 10 at 20:19
  • @AlanMunn I suppose I ought to use texlua but sed is more fun. May 10 at 20:20
  • Most Mac users are unlikely to bother to install GNU sed. So yes, perl would likely be better.
    – Alan Munn
    May 10 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.