Debian Codegraph @

texmf-dist/source/bibtex/bibtools/bibify

raw
1 #!/bin/csh -f
2
3 if ($1 !~ *.aux) then
4 set input=$1.aux
5 set bbl = $1.bbl
6 else
7 set input=$1
8 set bbl=$1:r.bbl
9 endif
10
11 set file=/tmp/bibify$$
12 onintr clean
13
14 cat $input > $file
15
16 set style=`sed -n 's/\\bibstyle{\(.*\)}/\1/p' $input`
17
18 switch($style)
19 case "alpha":
20 case "abstract":
21 cat $bbl | sed -n 's/bibitem\[\(.*\)\]{\(.*\)}/bibcite{\2}{\1}/p' >> $file
22 breaksw
23 case "plain":
24 case "unsrt":
25 case "abbrv":
26 cat $bbl | sed -n 's/bibitem/bibcite/p'| awk '{print $1"{"NR"}"}' >> $file
27 breaksw
28 default:
29 echo unknown bibliography style, cannot bibify.
30 goto clean
31 endsw
32
33 mv $file $input
34
35 clean:
36 /bin/rm -f $file.* >& /dev/null
37