Skip to content

Instantly share code, notes, and snippets.

@diogo-almeida
Created February 12, 2014 12:17
Show Gist options
  • Save diogo-almeida/8954540 to your computer and use it in GitHub Desktop.
Save diogo-almeida/8954540 to your computer and use it in GitHub Desktop.
Easy extraction of bibtex entries in databases created by JabRef
# The trick: Set Record Separator to nil, and Field Separator to newline.
# This capitalizes on the structure of how JabRef formats the database, where each entry is separated by a newline.
# The following command prints the first line of the record, which is the bibtex type field and the entry key.
BEGIN{RS=""; FS="\n"}
{print $1}
# Other possible options:
# {print $(NF) # This prints the last line (should be the closing curly bracket)
# {print $(NF - 1) # This prints the last field before the closing curly bracket
# ($1 ~ "Almeida") {print $0} # This would print all the entries that have "Almeida" as a key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment