# bib-select.awk - emit entries selected by key, canonically # # Requires bib-parse.awk and bib-canon.awk. Variables (set with -v): # keys - comma-separated list of entry keys # invert - 0: emit entries whose key is in the list # 1: emit entries whose key is NOT in the list # # With keys="" and invert=1 this acts as a canonicalizing filter for # everything. @string and @preamble blocks always pass through. BEGIN { bib_sel_n = split(keys, bib_sel_k, ",") for (bib_sel_i = 1; bib_sel_i <= bib_sel_n; bib_sel_i++) BIB_SEL[bib_sel_k[bib_sel_i]] = 1 } function bib_pass(raw) { if (bib_out_n++) print "" print raw } function bib_entry(type, key) { if ((key in BIB_SEL) != invert + 0) { if (bib_out_n++) print "" bib_emit(type, key) } }