[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 5

sortbib Command


Sorts a bibliographic database.


sortbib-sKeys ] [  Database ... ]


The sortbib command 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. The sortbib command reads through each database specified by the Database parameter and pulls out key fields, which are sorted separately. The sorted key fields contain the file pointer, byte offset, and length of corresponding records. These records are delivered using disk seeks and reads, so the sortbib command cannot be used in a pipeline to read standard input.

By default, the sortbib command alphabetizes by the first %A and %D fields, which contain the senior author and date.

The sortbib command sorts by the last word in the %A field, which is assumed 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.

Note: Records with missing author fields should be sorted by title.

The sortbib command sorts by the last word of the %D line, which is usually the year. It ignores leading articles when sorting by titles in the %T or %J fields. The 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 from a record, the sortbib command places 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.


-sKeys Specifies field keys to sort on.


  1. To sorts by author, title, and date:

    sortbib -sATD Database
  2. To sort by author and date:

    sortbib -sA+D Database


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

Related Information

The addbib command, indxbib command, lookbib command, refer command, roffbib command, sort command.

The refer message catalog in the AIX 5L Version 5.2 National Language Support Guide and Reference.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]