bibtorefer.sh 639 B

123456789101112131415161718192021
  1. #!/bin/sh
  2. sed "
  3. s/@\(book\|article\|InCollection\)\s*{\(.*\),/%L \2/I
  4. s/title\s*=\s*{\(.*\)},*/%T \1/I
  5. s/author\s*=\s*{\(.*\)},*/%A \1/I
  6. s/publisher\s*=\s*{\(.*\)},*/%I \1/I
  7. s/editor\s*=\s*{\(.*\)},*/%E \1/I
  8. s/doi\s*=\s*{\(.*\)},*/%K \1/I
  9. s/journal\s*=\s*{\(.*\)},*/%J \1/I
  10. s/volume\s*=\s*{\(.*\)},*/%V \1/I
  11. s/number\s*=\s*{\(.*\)},*/%N \1/I
  12. s/pages\s*=\s*{\(.*\)},*/%P \1/I
  13. s/booktitle\s*=\s*{\(.*\)},*/%B \1/I
  14. s/howpublished\s*=\s*{.url{\(.*\)}},/%O URL: \1 (accessed $(date '+%e %B %Y'))/I
  15. s/--/-/I
  16. s/%A \([A-Z.a-z]*\), \([A-Z .a-z]*\)/%A \2 \1/I
  17. s/year\s*=\s*{\(.*\)},*/%D \1/I
  18. s/^\s*//g
  19. /^[^%]/d
  20. s/\({\|}\)//g
  21. " "$@"