🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text
Article #6488

Re: Needed: tool to sort BibTeX files (Archive sites please read)

#6488
From: Ralph P. Sobek
Date: Mon, 05 Jun 1989 16:59
25 lines
1567 bytes
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
Technical Details
Message-ID: <371@laas.laas.fr>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!uunet!mcvax!inria!laas!nastassia!ralph
References: <23906@labrea.Stanford.EDU> <720@otc.otca.oz>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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