diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /biblio/bibtex/utils/bibtools/bibkey.sed |
Initial commit
Diffstat (limited to 'biblio/bibtex/utils/bibtools/bibkey.sed')
-rw-r--r-- | biblio/bibtex/utils/bibtools/bibkey.sed | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/biblio/bibtex/utils/bibtools/bibkey.sed b/biblio/bibtex/utils/bibtools/bibkey.sed new file mode 100644 index 0000000000..f203adb66f --- /dev/null +++ b/biblio/bibtex/utils/bibtools/bibkey.sed @@ -0,0 +1,32 @@ +# bibkey.sed +# +# Goes with bin/bibkey - look for a word in the keyword entry +# +# David Kotz (dfk@cs.dartmouth.edu) +# +# On stdin, we get a lowercased bibtex file with comments stripped. +# +# On stdout, we produce a list of line numbers that are the starting +# line number of each reference, and the text of all "keyword" +# entries on separate lines. + +# the idea is to get @ line numbers and all keywords +# @ entry +/^[ ]*@.*/= +# one-line keyword entry +s/[ ]*keyword[ ]*=[ ]*"\(.*\)".*/\1/p +t +# start of multi-line keyword entry +s/[ ]*keyword[ ]*=[ ]*"\(.*\)/\1/ +t partial +b +# Handle multi-line keyword entry: save this line, repeatedly add +# lines until close quote forces output +:partial +N +s/\(.*\n.*\)".*/\1/ +t done +b partial +:done +s/\n/ /g +p |