BIBSORT 1 "08 October 1999" "Version 0.14" [section 7 of 11]

.-3[OPTIONS]         .-2[BIBTEX FILE PARTS]         .-1[CAVEATS]
Top
.+1[BUGS]     .+2[SEE ALSO]         .+3[AUTHOR]


PROGRAMMING NOTES

Some text editors permit application of an arbitrary filter command to a region of text. For example, in GNU emacs(1), the command C-u M-x shell-command-on-region, or equivalently, C-u M-|, can be used to run bibsort on a region of the buffer that is devoid of cross references and other material that cannot be safely sorted.

Some implementations of BibTeX editing support in GNU emacs(1) have a sort-bibtex-entries command that is functionally similar to bibsort. However, the file size that can be processed by emacs(1) is limited, while bibsort can be used on arbitrarily large files, since it acts as a filter, processing a small amount of data at a time. The sort stage needs the entire data stream, but fortunately, the UNIX sort(1) command is clever enough to deal with very large inputs.

The current implementation of bibsort follows the UNIX tradition of combining simple already-available tools. A six-stage pipeline of egrep(1), nawk(1), sort(1), and tr(1) accomplishes the job in one pass with about 800 lines of heavily-commented shell script, about 400 lines of which is a nawk(1) program for insertion of sort keys. The initial prototype of bibsort was written and tested on several large bibliographies in a couple of hours, and after considerable use, was later extended with advanced sorting capabilities and cross-reference recognition in a couple of days of work. By contrast, bibtex(1) is more than 11 000 lines of code and documentation, and bibclean(1) is more than 15 000 lines long; both took months to develop, implement, and test.


.-3[OPTIONS]         .-2[BIBTEX FILE PARTS]         .-1[CAVEATS]
Top
.+1[BUGS]     .+2[SEE ALSO]         .+3[AUTHOR]