.TH BIB-ADD 1 "June 2026" "bibutils" "User Commands" .SH NAME bib-add \- insert bibtex entries into a database file .SH SYNOPSIS .B bib-add .RB [ \-f ] .I db.bib .SH DESCRIPTION .B bib-add reads one or more fully formatted bibtex entries on standard input and appends them to the database file .IR db.bib , creating it if necessary. Entries are canonicalized on the way in: entry types and field names are lowercased, values are brace-delimited with internal whitespace collapsed, bare numbers are left bare, and macro references and .B # concatenations are preserved verbatim. .PP If an incoming entry's key already exists in the database, the entry is rejected and the duplicate keys are reported on standard error, unless .B \-f is given. .SH OPTIONS .TP .B \-f Replace existing entries that share a key with an incoming entry. The database is rewritten canonically in the process. .SH EXIT STATUS 0 on success, 1 if no entries were read or a duplicate key was rejected, 2 on usage error. .SH ENVIRONMENT .TP .B BIBUTILS_LIB Directory holding the shared awk library, overriding the default search (lib/ next to the script, then /usr/local/share/bibutils). .SH EXAMPLES Add a fetched entry to a database: .nf bib-fetch paper.pdf | bib-add refs.bib .fi .SH SEE ALSO .BR bib-gen (1), .BR bib-key (1), .BR bib-util (1)