| 1 |
#!/bin/csh -f |
| 2 |
# |
| 3 |
# citekeys - print out all the cite keys in given bib files |
| 4 |
# |
| 5 |
# usage: |
| 6 |
# citekeys file.bib... |
| 7 |
# |
| 8 |
|
| 9 |
onintr cleanup |
| 10 |
|
| 11 |
if ($#argv < 1) then |
| 12 |
echo 'usage: citekeys file.bib...' |
| 13 |
exit 1 |
| 14 |
endif |
| 15 |
|
| 16 |
unset files |
| 17 |
foreach i ($*) |
| 18 |
if ($i:e == bib) then |
| 19 |
set file=$i:r |
| 20 |
else |
| 21 |
set file=$i |
| 22 |
endif |
| 23 |
|
| 24 |
if ($?files) then |
| 25 |
set files=($files,$i) |
| 26 |
else |
| 27 |
set files=($file) |
| 28 |
endif |
| 29 |
end |
| 30 |
|
| 31 |
echo creating citekeys.aux for $files |
| 32 |
|
| 33 |
cat > citekeys.aux <<EOF |
| 34 |
\relax |
| 35 |
\citation{*} |
| 36 |
\bibstyle{citekeys} |
| 37 |
\bibdata{$files} |
| 38 |
EOF |
| 39 |
|
| 40 |
rm -f citekeys.{log,dvi,bbl,blg} |
| 41 |
|
| 42 |
echo bibtex citekeys |
| 43 |
bibtex citekeys |
| 44 |
|
| 45 |
mv citekeys.bbl citekeys.out |
| 46 |
|
| 47 |
echo "" |
| 48 |
echo output is in citekeys.out |
| 49 |
|
| 50 |
cleanup: |
| 51 |
rm -f citekeys.{tex,aux,log,dvi,bbl,blg} |
| 52 |
|