Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!uunet!mcvax!inria!laas!nastassia!ralph From: ralph@nastassia.laas.fr (Ralph P. Sobek) Newsgroups: comp.text Subject: Re: Needed: tool to sort BibTeX files (Archive sites please read) Summary: A quick and dirty method: use GNU emacs Keywords: BibTeX, sort, GNU Emacs Message-ID: <371@laas.laas.fr> Date: 5 Jun 89 16:59:10 GMT References: <23906@labrea.Stanford.EDU> <720@otc.otca.oz> Sender: news@laas.laas.fr Reply-To: ralph@laas.laas.fr Organization: LAAS-CNRS, Toulouse, France Lines: 25 I have had to do this in the past. I defined a function for GNU emacs. On a Sun3-160 it took less than 1 minute to sort on the order 4000 references in a 1 Mbyte file. The key(s) can be changed; for the moment it's the reference key. It's set up to be run in batch mode. Here it is: (defun sort-BibTeX () (interactive) ; A BibTeX record entry here is defined to be: ; @name{key,\n...\n}$ ; For the moment, the key is (sort-regexp-fields nil "^@.*{\\(.*\\),\\\n\\(^[^}].*\\\n\\)*}$" "\\1" (point-min) (point-max)) (set-visited-file-name (concat (buffer-file-name) ".sorted")) ) Of course, if anyone makes any improvements I would be interested in receiving them also. Ralph P. Sobek Disclaimer: The above ruminations are my own. ralph@laas.laas.fr Addresses are ordered by importance. ralph@laas.uucp, or ...!uunet!mcvax!laas!ralph If all else fails, try: SOBEK@FRMOP11.BITNET sobek@eclair.Berkeley.EDU