[comp.text.tex] Bibliography management tools, take 2

ajayshah@alhena.usc.edu (Ajay Shah) (12/16/90)

(If you've never seen this before, read on ahead for the read.me
me file which is the first file in the shar archive.)

Several people told me they had problems with the sharfile I
posted last time.  Here is it again, with some improvements.
Even if you had no problems with the last archive, you should use
this version because all programs have the identical
functionality but more error checking.


#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  read.me db2bib db2bib.awk demo.db lookfor makefile.useful
#   sortdb
# Wrapped by ajayshah@alhena.usc.edu on Sat Dec 15 14:07:46 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f read.me -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"read.me\"
else
echo shar: Extracting \"read.me\" \(2296 characters\)
sed "s/^X//" >read.me <<'END_OF_read.me'
X
XThis is how I manage my database of references.
X
XYou create files *.db by hand.  These are in a certain, somewhat rigid format.
XThese are sorted by the program sortdb.
XThey are converted into LaTeX .bib format by the program db2bib.
XYou search for keywords using the program lookfor.
X
X---------------------------------------------------------------------------
XFile List:
X
X* db2bib
X	Program which converts .db file to .bib format.
X* db2bib.awk
X	Awk script used by db2bib.
X* demo.db
X	A .db file you can play with before you have your own.
X* lookfor
X	Program which prints references which contain a keyword.
X* makefile.useful
X	A makefile useful when frequently using these programs.
X* read.me
X	This file.
X* sortdb
X	Program which sorts a .db file.
X---------------------------------------------------------------------------
XInstallation aspects:
X
X	You only need to setup the gawk shell variable in the
X	cshell programs db2bib and lookfor
X	(Be sure to chmod +x db2bib lookfor sortdb)
X
X	demo.db is a demonstration of what the .db file should look
X	like.  You can delete it the moment you've understood it.
X	(db2bib demo.db should yield zero errors.)
X
X---------------------------------------------------------------------------
XUsages:
X	sortdb dbfiles
X	db2bib dbfiles
X	lookfor keyword dbfiles
X
XSample session, comments in brackets:
X
X$ vi econ.db
X	(add references into the file in a certain format)
X$ db2bib econ.db
X	(recreate econ.bib from new econ.db)
X$ sortdb econ.db
X	(sort econ.db afresh)
X$ lookfor india *.db | more
X	(lookfor any paper containing the string 'india')
X$ lookfor lucas econ.db | more
X	(look at references containing word "lucas" in econ.db only)
X$ lookfor lucas econ.db > lucas.bib
X	(put these into lucas.bib)
X
X---------------------------------------------------------------------------
X
Xdb file format:
X	- one line for one reference
X	- pipe-seperated fields
X	- first field MUST be @book or @inproceedings or @article or so
X	- 2nd field MUST be what the reference is cited by
X	- then put in as many fields as you want in whatever order
X	- last field MUST be keywords for fulltext querying.
X		(blank field is fine, but it must be present)
X
X---------------------------------------------------------------------------
XSuggestions welcome!
Xajayshah@usc.edu
XSat Dec 15 14:06:39 PST 1990
END_OF_read.me
if test 2296 -ne `wc -c <read.me`; then
    echo shar: \"read.me\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f db2bib -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"db2bib\"
else
echo shar: Extracting \"db2bib\" \(844 characters\)
sed "s/^X//" >db2bib <<'END_OF_db2bib'
X#
Xif ($#argv == 0) then
X	echo Usage:
X	echo "	" $0 " files"
X	echo "";
X	echo The textfile database files get converted into LaTeX bib form
X	exit 1
Xendif
X
Xset awkscript="./db2bib.awk"
Xset gawk="/max/a/bin/gawk"
Xif !(-e $awkscript) then
X	echo $0: Sorry, need awk script $awkscript in order to run.
X	exit 1
Xendif
Xif !(-e $gawk) then
X	echo $0: Sorry, need $gawk in order to run.
X	exit 1
Xendif
X
Xforeach file ($*)
X	if (-e $file) then
X		if ($file:e != "db") then
X			echo $0 ":" $file does not have a .db extension
X		else
X			echo -n $file --">" $file:r.bib
X			$gawk -f $awkscript $file > $file:r.bib
X			if ($status != 0) then
X				echo $file --">" $file:r.bib failed!
X				set fail=1
X			endif
X			echo " (" `wc -l < $file` entries")"
X		endif
X		echo ""
X	else
X		echo $0 ":" $file not found.
X	endif
Xend
Xecho ""
X
Xif ($fail == 1) then
X	exit 1
Xelse
X	exit 0
Xendif
END_OF_db2bib
if test 844 -ne `wc -c <db2bib`; then
    echo shar: \"db2bib\" unpacked with wrong size!
fi
chmod +x db2bib
# end of overwriting check
fi
if test -f db2bib.awk -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"db2bib.awk\"
else
echo shar: Extracting \"db2bib.awk\" \(1719 characters\)
sed "s/^X//" >db2bib.awk <<'END_OF_db2bib.awk'
X
X# This script takes a reference database file in the textfile
X# form (one reference per line) and converts it into a LaTeX
X# bibliography.
X#
X# Organisation of file:
X# first field MUST be @article or so
X# 2nd field MUST be what the article is going to be cited as
X# then as many fields of as much info as you like
X# last field (could be blank, but MUST exist) is keywords.
X#
X# Ajay Shah, 10 December 1990
X
XBEGIN {FS = "|";
X	stderr = "/dev/tty"
X	}
X
X(NF > 0) {# so he silently ignores blank lines in .db file
X
X	#------------------------------------------------------------
X	#throw in some error checking for free:
X	# 0. All keys used in one file must be unique.
X	if ($2 in cache) {
X		print "Error: Key " $2 " used more than once." > stderr;
X		print "(used on line " cache[$2] " and on " NR  ")" > stderr;
X		goch = 1
X	}
X	# 1. If a field contains a { it should also contain a }
X	for (i=1; i<=NF; i++) {
X		if ($i ~ /{/) {
X			if ($i !~ /}/) {
X				print "" > stderr;
X				print "Error in field " i " on line " NR > stderr;
X				print "Errant field: " $i > stderr;
X				goch = 1
X			}
X		}
X	}
X	# 2. Apart from the 1st two and the last field, all fields
X	# must contain a =
X	for (i=3; i<=(NF-1); i++) {
X		if ($i !~ /\=/) {
X			print "" > stderr;
X			print "Error in field " i " on line " NR > stderr;
X			print "Errant field: " $i > stderr;
X			goch = 1
X		}
X	}
X	cache[$2] = NR;
X	#end of code for error checking.
X	#------------------------------------------------------------
X
X	print ""; print $1 "{";
X	for (i=2; i<=(NF-2); i++) print "	" $i ",";
X	print "	" $(NF-1);
X		# notice field $NF never gets used because it's the
X		# keywords.
X	print "}"; print ""
X	# 4 lines of code is all it takes other than error checking!
X}
X
XEND {exit goch}
X
END_OF_db2bib.awk
if test 1719 -ne `wc -c <db2bib.awk`; then
    echo shar: \"db2bib.awk\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f demo.db -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"demo.db\"
else
echo shar: Extracting \"demo.db\" \(9496 characters\)
sed "s/^X//" >demo.db <<'END_OF_demo.db'
X@book|Laffont|author={Laffont, J. J}|title={The Economics of Uncertainty and Information}|year={1989}|publisher={MIT Press}|
X@incollection|Lucas80|author={Robert E. Lucas}|title={Methods and Problems in Business Cycle Theory}|booktitle={Studies in Business Cycle Theory}|publisher={MIT Press}|year={1982}|
X@incollection|Lucas76|author={Robert E. Lucas}|title={Econometric Policy Evaluation: A Critique}|booktitle={The Phillips Curve and Labour Markets}|year={1976}|organization={Carnegie-Rochester Conference Series on Public Policy, Vol. 1}|publisher={North-Holland}|
X@techreport|B_Cole89|author={Etienne Barnard and Ronald A. Cole}|title={A neural-net training program based on conjugate-gradient optimisation}|institution={Department of Computer Science, Oregon Graduate Center}|number={89-014}|month={July}|year={1989}|
X@inproceedings|FL90|author={Fahlman, S.E. and Lebiere, C.}|title={The Cascade Correlation Learning Architecture}|year={1990}|booktitle={Advances in Neural Information Processing Systems 2}|editor={D. S. Touretzky}|publisher={Morgan Kaufmann}|address={San Mateo, CA}|
X@inproceedings|Gross81|author={Grossberg, S.}|title={Adaptive Resonance in Development, Perception and Cognition}|year={1981}| booktitle={SIAM-AMS Proceedings 13}|
X@inproceedings|HU89|author={Honavar, V. and Uhr, L}|title={Generation, Local Receptive Fields and Global Convergence Improve Perceptual Learning in Connectionist Networks}|booktitle={Proceedings of the Eleventh IJCAI}|publisher={Morgan Kaufmann}|address={San Mateo, CA}|year={1989}|
X@article|LeeOld90|title={Font recognition by a neural network}|author={Ming-Chih Lee and William J. B. Oldham}|journal={Int. J. Man-Machine Studies}|year={1990}|
X@article|Lins88|author={Linsker, R.}|year={1988}|title={Self-organization in a perceptual network}|journal={Computer}|volume={21}|number={3}|
X@incollection|Mich83|title={A Theory and Methodology of Inductive Learning}|author={Michalski, R.S.}|year={1983}|editor={R.S. Michalski and J.G. Carbonell and T.M. Mitchell}|booktitle={Machine Learning: An Artificial Intelligence Approach}|publisher={Tioga}|address={Palo Alto, CA}|
X@techreport|Moller90|author={Martin F. Moller}|title={A Scaled Conjugate Gradient Algorithm for Fast Supervised Learning}|month={November}|year={1990}|institution={Computer Science Department, Unversity of Aarhus, Denmark}|number={PB-339}|
X@book|MR88|author={McClelland, J.L. and Rumelhart, D.E.}|title={Explorations in Parallel Distributed Processing: A Handbook of Models, Programs, and Exercises}|publisher={MIT Press/Bradford Books}|year={1988}|
X@article|Norris90|title={How to build a connectionist idiot (savant)}|author={Dennis Norris}|journal={Cognition}|year={1990}|
X@article|Quin86|author={Quinlan, J.R.}|year={1986}|title={Induction of Decision Trees}|journal={Machine Learning}|volume={1}|
X@book|RMP86|title={Parallel Distributed Processing: Explorations in the Microstructure of Cognition, Vol. 1.}|author={Rumelhart, D.E. and McClelland, J.L. and {the PDP research group}}|year={1986}|publisher={MIT Press/Bradford Books}|
X@inproceedings|SD88|author={Shekhar and Dutta}|year={1988}|title={Bond rating: A non-conservative application of neural networks}|booktitle={IEEE International Conference on Neural Networks}|
X@incollection|SFI|title={Neural Nets for Economists}|author={Baum??}|year={1988}|editor={Philip Morrison, Kenneth Arrow and xxx}|booktitle={Don't recall}|publisher={???}|address={???}|
X@article|ST89|author={Shavlik, J.W. and Towell, G.G.}|year={1989}|title={An Approach to Combining Explanation-based and Neural Learning Algorithms}|journal={Connection Science}|volume={1}|number={3}|
X@techreport|TangFishwick|author={Zaiyong Tang and Paul A. Fishwick}|title={A Comparative Study of the Neural Network and Box-Jenkins Methodology in Forecast Modelling}|month={June}|year={1990}|institution={Department of CIS Working Paper, Univeristy of Florida}|address={Gainesville, Florida}|
X@article|TS89|author={Tesauro, G. and Sejnowski, T.J.}|title={A parallel network that learns to play backgammon}|year={1989}|journal={Artificial Intelligence}|volume={39}|
X@inproceedings|Weiss_Kapouleas|author={Sholom M. Weiss and Ioannis Kapouleas}|title={An Empirical Comparison of Pattern Recognition, Neural Nets, and Machine Learning Classification Methods}|booktitle={Proc. IJCAI-89}|address={Detroit, MI}|year={1989}|
X@techreport|WHR90|author={Andreas S. Weigend and Bernardo A. Huberman and David E. Rumelhart}|title={Predicting the Future: A Connectionist Approach}|month={April}|year={1990}|institution={PDP Research Group Working Paper, Stanford}|
X@article|HansenSalamon|title={Neural Network Ensembles}|author={Lars Kai Hansen and Peter Salamon}|journal={IEEE Trans. on Pattern Analysis and Machine Intelligence}|volume={12}|number={10}|month={October}|year={1990}|
X@article|Fuk_Hay89|title={Estimation of Classifier Performance}|author={Keinosuke Fukunaga and Raymond R. Hayes}|journal={IEEE Trans. on Pattern Analysis and Machine Intelligence}|volume={II}|number={10}|month={October}|year={1989}|
X@techreport|HSW89|title={Multi-layer Feedforward Networks are Universal Approximators}|author={Kurt Hornik and Maxwell Stinchcombe and Halbert White}|institution={Department of Economics, UC San Diego}|month={February}|year={1989}|
X@techreport|White88|title={Multilayer Feedforward Networks Can Learn Arbitrary Mappings: Connectionist Nonparametric Regression with Automatic and Semi-Automatic Determination of Network Complexity}|author={Halbert White}|month={November}|year={1988}|institution={Department of Economics, UC San Diego}|
X@techreport|White89|title={An additional hidden unit test for neglected nonlinearity in multilayer feedforward networks}|author={Halbert White}|month={February}|year={1989}|institution={Department of Economics, UC San Diego}|
X@techreport|White87|title={Some Asymptotic Results for Learning in Single Hidden Layer Feedforward Network Models}|author={Halbert White}|month={February}|year={1987}|institution={Department of Economics, UC San Diego}|
X@book|Amemiya|author={Takeshi Amemiya}|title={Advanced Econometrics}|publisher={Harvard University Press}|year={1985}|
X@techreport|Ans_Mini|author={Ajay Shah and Ganesh Mani}|title={Statistical Methods vs. a Neural Network on the Problem of Rating Firms}|note={mimeo}|year={1990}|institution={Department of Economics, USC}|
X@book|CART84|author={Leo Breiman and Jerome H. Friedman and Richard A. Olshen and Charles J. Stone}|title={Classification and Regression Trees}|publisher={Wadsworth \& Brooks/Cole Advanced Books \& Software}|year={1984}|address={Monterey, California}|
X@article|FreedPeters84|author={David A. Freedman and Stephen C. Peters}|journal={Journal of Business and Economic Statistics}|number={2}|volume={2}|month={April}|year={1984}|title={Bootstrapping an Econometric Model: Some Empirical Results}|
X@article|FRS83|author={David Freedman and Thomas Rothenberg and Richard Sutch}|journal={Journal of Business and Economic Statistics}|title={On Energy Policy Models}|number={1}|volume={1}|month={January}|year={1983}|
X@article|Haggstrom83|author={Gus W. Haggstrom}|title={Logistic Regression and Discriminant Analysis by Ordinary Least Squares}|journal={Journal of Business and Economic Statistics}|volume={1}|number={3}| year={1983}|
X@book|Judge|author={Judge and Griffiths and Lutkepohl and Lee}|title={Econometrics}|publisher={abc}|year={xyz}|
X@techreport|Kalaba_Tesf_AMPE|author={Robert Kalaba and Z. Lichtenstein and T. Simchony and L. Tesfatsion}|title={Linear and Nonlinear Associative Memories for Parameter Estimation}|institution={Modelling Research Group, USC}|month={September}|year={1989}|
X@techreport|LWhiteGranger89|author={Tae-Hwy Lee and Halbert White and Clive W. J. Granger}|title={Testing for Neglected Nonlinearity in Time Series Models: A Comparison of Neural Network Methods and Alternative Tests}|institution={Department of Economics, UC San Diego}|month={October}|year={1989}|
X@book|Maddala83|author={G. S. Maddala}|title={Limited-dependant and qualitative variables in Econometrics}|publisher={Cambridge University Press}|year={1983}|
X@incollection|McFadden89|author={Daniel McFadden}|title={Testing for Stochastic Dominance}|year={1989}|booktitle={Studies in the Economics of Uncertainty}|editor={Fomby, T. and T. K. Seo}|publisher={Springer}|address={New York}|
X@book|MGB|author={Mood and Graybill and Boes}|title={Intro to Stats}|publisher={McGraw Hill International Edition}|year={1975}|
X@book|NR|author={Press and Flannery and Teukolsky and Vetterling}|title={Numerical Recipes: The Art of Scientific Computing}|publisher={Cambridge University Press}|year={1989}|
X@article|RPA85|title={Introducing Recursive Partitioning for Financial Classification: The Case of Financial Distress}|author={Halina Frydman and Edward I. Altman and Duen-Li Kao}|journal={Journal of Finance}|volume={XL}|number={1}|month={March}|year={1985}|
X@techreport|Shah90|author={Ajay Shah}|title={Model Selection based on Out-of-Sample Prediction with Cross-Sectional Data}|note={mimeo}|year={1990}|
X@book|SIAM_boot|author={Bradley Efron}|title={The Bootstrap, the Jacknife and Other Resampling Plans}|publisher={SIAM}|year={1987}|
X@book|Wahba90|author={Grace Wahba}|title={Spline Models for Observational Data}|publisher={SIAM}|year={1990}|
X@techreport|White88_20|title={Economic Prediction Using Neural Networks: The Case of IBM Daily Stock Returns}|institution={Department of Economics, UC San Diego}|number={20}|year={1988}|author={Halbert White}|
END_OF_demo.db
if test 9496 -ne `wc -c <demo.db`; then
    echo shar: \"demo.db\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f lookfor -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"lookfor\"
else
echo shar: Extracting \"lookfor\" \(804 characters\)
sed "s/^X//" >lookfor <<'END_OF_lookfor'
X#
Xif ($#argv < 2) then
X	echo Usage:
X	echo "	" $0 " word filenames"
X	echo ""
X	echo displays all papers which seem to match word in filenames.
X	echo Only one word is allowed, but many filenames are allowed.
X	echo ""
X	echo You can redirect the output or pipe through more.
X	exit 1
Xendif
Xset awkscript=db2bib.awk
Xset gawk=/max/a/bin/gawk
Xset stderr=/dev/tty
Xif !(-e $awkscript) then
X	echo $0: Sorry, need file $awkscript in order to run > stderr
X	exit 1
Xendif
Xif !(-e $gawk) then
X	echo $0: Sorry, need file $gawk in order to run > stderr
X	exit 1
Xendif
Xforeach file ($2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16)
X	if !(-e $file) then
X		echo Database file $file does not exist. > stderr
X	else
X		grep -i $1 $file | $gawk -f $awkscript
X	endif
Xend
X# $1 is the word,
X# hope there aren't more than 15 files!
END_OF_lookfor
if test 804 -ne `wc -c <lookfor`; then
    echo shar: \"lookfor\" unpacked with wrong size!
fi
chmod +x lookfor
# end of overwriting check
fi
if test -f makefile.useful -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"makefile.useful\"
else
echo shar: Extracting \"makefile.useful\" \(240 characters\)
sed "s/^X//" >makefile.useful <<'END_OF_makefile.useful'
X
XTOARCHIVE = read.me \
X	db2bib sortdb lookfor \
X	db2bib.awk \
X	demo.db \
X	makefile
X
Xallbibs :
X	db2bib *.db
X
Xclean :
X	rm -f *.bib bibman.01
X
Xbackup : clean
X	cp neural.db demo.db
X	shar -o bibman -c -C $(TOARCHIVE)
X	rm demo.db
X	ls -la bibman*
END_OF_makefile.useful
if test 240 -ne `wc -c <makefile.useful`; then
    echo shar: \"makefile.useful\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f sortdb -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"sortdb\"
else
echo shar: Extracting \"sortdb\" \(439 characters\)
sed "s/^X//" >sortdb <<'END_OF_sortdb'
X#
Xif ($#argv == 0) then
X	echo Usage:
X	echo "	" $0 " files"
X	echo "";
X	echo where files are in textfile database form, not LaTeX bib form
X	exit 1
Xendif
X
Xforeach file ($*)
X	if (-e $file) then
X		if ($file:e != "db") then
X			echo $0 ":" $file does not have a .db extension.
X		else
X			echo -n $file...
X			sort -f +1 -t\| -o $file $file
X			echo "(" `wc -l < $file` entries")"
X		endif
X	else
X		echo $0 ":" $file does not exist
X	endif
Xend
Xecho ""
X
END_OF_sortdb
if test 439 -ne `wc -c <sortdb`; then
    echo shar: \"sortdb\" unpacked with wrong size!
fi
chmod +x sortdb
# end of overwriting check
fi
echo shar: End of shell archive.
exit 0
-- 
_______________________________________________________________________________
Ajay Shah, (213)734-3930, ajayshah@usc.edu
                              The more things change, the more they stay insane.
_______________________________________________________________________________

ggovind@uceng.UC.EDU (Girish Govind) (12/16/90)

ajayshah@alhena.usc.edu (Ajay Shah) writes:

>(If you've never seen this before, read on ahead for the read.me
>me file which is the first file in the shar archive.)

>Several people told me they had problems with the sharfile I
>posted last time.  Here is it again, with some improvements.
>Even if you had no problems with the last archive, you should use
>this version because all programs have the identical
>functionality but more error checking.

Just a few days back there was a shar posted that had several programs
that did different things to the bibtex entry files. There was a shell script
called "btt" that invoked the appropriate one.... Well, I tried this one
along with looking in the database file for certain entries and I think
it is excellent. I would suggest that people who are looking for a 
bibliography database management program and work with bibtex should
definitely try this one. I forget the name of the poster but you can probably
roll back messages and find it yourself.

It is GREAT! All I had to do was modify the print command in the shell
script to the local print command and change "less" to "more" as that
is what I have here and it works very well.

Also, another thing to note is that it does everything with only ONE
bib file. No conversion is required etc. to some other format to 
facilitate referring to the database.

Just my $.02 worth.....

				Girish Govind