Skip to content

Instantly share code, notes, and snippets.

@elehcim
Created March 3, 2021 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elehcim/1874e74c822295e1b37dfb788d3ca8e6 to your computer and use it in GitHub Desktop.
Save elehcim/1874e74c822295e1b37dfb788d3ca8e6 to your computer and use it in GitHub Desktop.
Abbreviate Astronomical journals in a bib file
#!/bin/bash
# Usage:
# abbrv "input_file.bib" > output_file.bib
file=$1
awk '{sub(/{Annual Review of Astronomy and Astrophysics}/, "{ARA\{\\\\\\&\}A}"); print}' $file |
awk '{sub(/{Monthly Notices of the Royal Astronomical Society}/,"{MNRAS}"); print}' |
awk '{sub(/{Mon. Not. R. Astron. Soc}/,"{MNRAS}"); print}' |
awk '{sub(/{Publications of the Astronomical Society of the Pacific}/,"{PASP}"); print}' |
awk '{sub(/{The Astronomical Journal}/,"{AJ}"); print}' |
awk '{sub(/{Astronomical Journal}/,"{AJ}"); print}' |
awk '{sub(/{Astrophysical Journal Letters}/,"{ApJL}"); print}' |
awk '{sub(/{Astrophysical Journal}/,"{ApJ}"); print}' |
awk '{sub(/{The Astrophysical Journal}/,"{ApJ}"); print}' |
awk '{sub(/{Astrophysical Journal Supplement Series}/,"{ApJS}"); print}' |
awk '{sub(/{The Astrophysical Journal Supplement Series}/,"{ApJS}"); print}' |
awk '{sub(/{Astronomy and Astrophysics}/,"{A\{\\\\\\&}A\}"); print}' |
awk '{sub(/{Astronomy \{\\\&\} Astrophysics}/,"{A\{\\\\\\&}A\}"); print}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment