#!/bin/sh # biber2txt bibfile.bib keys... - display bibliography entries as plain text # Needs pandoc, pandoc-citeproc and jq # Recommended: install https://raw.githubusercontent.com/citation-style-language/styles/master/journal-of-applied-philosophy.csl as ~/.pandoc/default.csl bibfile=${1?Usage: $0 bibfile.bib keys...} shift if [ "$#" -eq 0 ]; then IFS=' ' set -- $(pandoc-citeproc -j "$bibfile" | jq -r '.[].id') fi printf '[@%s]\n' "$@" | pandoc --bibliography "$bibfile" --standalone --to plain | awk 'NR!=FNR {exit} NR==1,/^$/{next} /^\[[0-9]*\]/ {$1 = "[" ARGV[+substr($1,2)+2] "]"} {print}' - "$0" "$@" | fmt