Last active
November 4, 2019 15:02
-
-
Save johnghill/896d115f720f2f1e7c0d to your computer and use it in GitHub Desktop.
[BibTeX] [JabRef] [keys] Replace citation keys in existing TeX document after globally altering key generation pattern in JabRef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### STEPS | |
# JabRef: Back-up original bibtex keys to new var called Orig_bibtexkey | |
# JabRef: Amend key pattern (as you do...) | |
# JabRef: Create custom export.layout file below | |
# echo '\format[GetOpenOfficeType]{\bibtextype},"\bibtexkey","\Orig_bibtexkey",' > jabref-export-keysonly.layout | |
# JabRef: Exprt to .csv, then to .txt file | |
# One line per pair of citations, each pair separated by [space] | |
# Execute this bash script on target .tex file: sh ./key-switch.sh | |
### | |
cat map.txt | while read line; do | |
neww=${line##* }; | |
oldw=${line%% *}; | |
find ./ -type f -name "*.tex" -exec sed -i "s/\b$oldw\b/$neww/g" {} \; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment