blob: b296f656ca5338e2a160e1439da5587fa50a83c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# bibkey.awk
#
# Goes with bin/bibkey - look for a word in the keyword entry
#
# David Kotz (dfk@cs.dartmouth.edu)
#
# On stdin, we get a list of line numbers of the beginning of entries
# (in the concatenated bibtex input) and the text of lines from keyword
# entries that have the keyword in them.
#
# On stdout, we produce a sed script for printing entries that had a
# match in them somewhere. This is a list of lines like "A,Bp" where A
# and B are line numbers.
BEGIN {found=0; last=1}
{
# test: is line a number?
if ($1+0 > 0) {
if (found) {
print last "," $1-1 "p";
found=0
}
last=$1
} else {
found = 1
}
}
END {
if (found)
print last ",$p";
}
|