# Last edited on 2022-11-21 08:10:07 by stolfi SPLITTING THE NEW INSTALLMENTS OF THE BIBLIOGRAPHY Assumes the old files have been split in "split-bib" bdir="split-bib" (cd ${bdir} && ls */*.bib ) | sort > .files-0.bib printf "%s: total %d entries\n" "${bdir}" "`cat .files-0.bib | wc -l`" split-bib: total 1322 entries # After lot 5 split-bib: total 1374 entries # After lot 6 split-bib: total 1497 entries # After lot 7 Splitting the new files: n=7 # Number of new lot of entries. nfile="others-new-${n}.bib" ndir="split-bib-new-${n}" split_new_bib_entries.sh ${nfile} ${ndir} ( cd ${ndir} && ls */*.bib ) | sort > .files-${n}.bib bool 1.2 .files-${n}.bib .files-0.bib > .dup0 if [[ -s .dup0 ]]; then echo "** key collisions in 0 ${n}:" cat .dup0 fi others-new-6.bib: total 52 keys others-new-7.bib: total 123 keys Merging the new entries into the old split directory: now="`date +%Y-%m-%d-%H%M%S`" tar -cvzf SAVE/${now}-${bdir}.tgz ${bdir} for y in `cd ${ndir} && ls -d [0-9][0-9][0-9][0-9]` ; do mv -vi ${ndir}/${y}/*.bib ${bdir}/${y} done Besides the new entries, several old entries in "split-bib" were edited. Therefore must re-build the three bibliographies "stolfi.bib", "students.bib", "others.bib" from them. Also put junk entries in "junk.bib". now="`date +%Y-%m-%d-%H%M%S`" mkdir -p SAVE/${now} cp -av {stolfi,students,others}.bib SAVE/${now}/ bdir=split-bib rejoin_split_bib.sh ${bdir} stolfi 2523 lines 232 entries students 340 lines 26 entries others 12733 lines 1231 entries junk 111 lines 8 entries >>> TO DO >>> SORTING THE BBLIOGRAPHY WITH BIB TOOLS for bibname in others ; do bibtool \ -v \ -i ${bibname}.bib \ -r bib-sort-by-title.rsc \ -m .${bibname}-macros-def \ -M .${bibname}-macros-used \ -o .${bibname}-sort.bib done bibtex_sort.py others.bib > .others-sort.bib # Last edited on 2007-08-12 00:44:33 by stolfi COMPARING BIBTEX FILES WITH OTHER SOURCES Listing all entries in a clean format: foreach f ( others stolfi students ) set ifile = "${f}.bib" set ofile = "/tmp/${f}-clean.bib" set isfile = "/tmp/${f}-srt.bib" set osfile = "/tmp/${f}-clean-srt.bib" set dfile = "/tmp/${f}-diff.bib" extract-bibtex-entries -v invert=1 ${ifile} > ${ofile} sort ${ifile} | sed -e 's:, *$::g' -e '/^ *$/d' > ${isfile} sort ${ofile} | sed -e 's:, *$::g' -e '/^ *$/d' > ${osfile} diff -Bb ${isfile} ${osfile} > ${dfile} end >>> DONE >>> SPLITTING THE BIBLIOGRAPHY bdir="split-bib" mkdir -pv ${bdir} rm -rf ${bdir}/* for f in stolfi.bib students.bib others.bib ; do split_bib.gawk -v bdir="${bdir}" $f done ln -s ${bdir} split-bib CKECKING "STOLFI" AND "STUDENTS" BIBLIOGRAPHIES for ff in stolfi students ; do if [[ $ff = "stolfi" ]]; then pat='ANON|(author|editor).*J([.]|orge)[{} ]*Stolfi' else pat='dvisor.*J([.]|orge)[{} ]*Stolfi' fi egrep -l -e "${pat}" ${bdir}/*/*.bib \ | sed -e 's:.*/::g' -e 's:[.]bib::g' \ | sort > .${ff}.bibs egrep -e '^[@]' ${ff}.bib \ | sed -e 's:^@.*{::g' -e 's:[, ]*$::g' \ | sort > .${ff}-org.bibs wc -l .${ff}{-org,}.bibs prdiff -BB .${ff}{-org,}.bibs done 234 .stolfi-org.bibs 234 .stolfi.bibs 26 .students-org.bibs 26 .students.bibs (no differences) CHECKING IF KEYS ARE PROPERLY SPLIT cat stolfi.bib students.bib others.bib \ | egrep -e '^[@]' \ | sort > .joint.keys cat split-bib/*/*.bib \ | egrep -e '^[@]' \ | sort > .split.keys wc -l .joint.keys .split.keys prdiff -BB .joint.keys .split.keys for f in joint split ; do \ echo "=== ${f} ===" cat .${f}.keys | uniq -d done 1321 .joint.keys 1321 .split.keys (no duplicate keys)