I'd like to be able to use a tool like grep to extract an entire bibtex reference rather than just the matching line.
For example, grep Smith mydatabase.bib would return lines that contain the word Smith. I'd like to have a command-line program that returned the entire bibtex reference that encloses the word Smith.
- How can this be done on the command-line?
In particular, I'd be interested in whether there is a way of using sed or awk to perform the task?
bibtool '--select{"Smith"}' mydatabase.bibdid what I wanted (i.e., send matches to standard out). It took me a little while to realise that on my shell I needed to enclose the--select{...}in single quotes. – Jeromy Anglim Sep 17 '11 at 10:40$a). – ado sar Jun 18 '22 at 19:32