Sorts a bibliographic database.

sortbib [ -sKeys ] [ Database ]

Sorts files of records containing refer command key letters by user-specified keys. The records can be separated by blank lines, or enclosed by the .[ (period, left bracket) and the .] (period, right bracket) delimiters, but the two styles cannot be mixed together.
Reads through each database and pulls out key fields containing the file pointer, byte offset, and length of corresponding records which are sorted separately.
Cannot be used in a pipeline to read standard input

. By default, alphabetizes by the first %A and %D fields, which contain the senior author and date. Sorting by the last word in the %A field, which is expected to be the author's last name.
A word in the final position, such as jr. or ed., is ignored if the name preceding ends with a comma. Authors with two-word last names, or names with uncommon constructions, can be sorted correctly by using the nroff command convention \0 in place of a space character.
Specifying the %Q field is similar to the %A field, except sorting begins with the first, not the last, word.

Records with missing author fields should be sorted by title.

sorts by the last word of the %D line, which is usually the year, ignoreing leading articles when sorting by titles in the %T or %J fields.
Articles ignored are specific to the locale and specified in the locale-specific refer message catalog. Within this catalog, the articles are contained in a single message. Each article is separated by any number of ASCII space or tab characters. If a sort-significant field is absent they are placed the record before other records containing that field.

No more than 16 databases can be sorted together at one time. Records longer than 4096 characters are truncated.

The Database parameter contains refer command key letters by user-specified keys that the sortbib command sorts through.

Flags Item Description -sKeys Specifies field keys to sort on.


To sorts by author, title, and date: sortbib -sATD Database

To sort by author and date: sortbib -sA+D Database


/tmp/SbibXXXXX the temporary file.
/usr/bin/sort Contains the sort command.

Related information addbib , indxbib, roffbib message catalog