Skip to content

Instantly share code, notes, and snippets.

@nikosavola
Created May 11, 2022 06:31
Show Gist options
  • Save nikosavola/31dac8430e272dd847283ec07efc27d9 to your computer and use it in GitHub Desktop.
Save nikosavola/31dac8430e272dd847283ec07efc27d9 to your computer and use it in GitHub Desktop.
Very bruteforce sed commands to convert BibTeX month fields to int, see https://tex.stackexchange.com/questions/351103/convert-month-jan-or-month-jan-strings-in-bib-files-into-integer
#!/bin/bash
sed -i -e 's/\(^ *month\) *= *["{]{*jan}*[}"]/\1 = "1"/i' references.bib
sed -i -e 's/\(^ *month\) *= *["{]{*feb}*[}"]/\1 = "2"/i' references.bib
sed -i -e 's/\(^ *month\) *= *["{]{*mar}*[}"]/\1 = "3"/i' references.bib
sed -i -e 's/\(^ *month\) *= *["{]{*apr}*[}"]/\1 = "4"/i' references.bib
sed -i -e 's/\(^ *month\) *= *["{]{*may}*[}"]/\1 = "5"/i' references.bib
sed -i -e 's/\(^ *month\) *= *["{]{*jun}*[}"]/\1 = "6"/i' references.bib
sed -i -e 's/\(^ *month\) *= *["{]{*jul}*[}"]/\1 = "7"/i' references.bib
sed -i -e 's/\(^ *month\) *= *["{]{*aug}*[}"]/\1 = "8"/i' references.bib
sed -i -e 's/\(^ *month\) *= *["{]{*sep}*[}"]/\1 = "9"/i' references.bib
sed -i -e 's/\(^ *month\) *= *["{]{*oct}*[}"]/\1 = "10"/i' references.bib
sed -i -e 's/\(^ *month\) *= *["{]{*nov}*[}"]/\1 = "11"/i' references.bib
sed -i -e 's/\(^ *month\) *= *["{]{*dec}*[}"]/\1 = "12"/i' references.bib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment