xref: /original-bsd/old/refer/sortbib/sortbib.1 (revision 817cfbae)
1.\" Copyright (c) 1983, 1990, 1991 Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)sortbib.1	6.3 (Berkeley) 04/22/91
7.\"
8.Dd
9.Dt SORTBIB 1
10.Os BSD 4.2
11.Sh NAME
12.Nm sortbib
13.Nd sort bibliographic database
14.Sh SYNOPSIS
15.Nm sortbib
16.Op Fl s Ar KEYS
17.Ar database Ar ...
18.Sh DESCRIPTION
19.Nm Sortbib
20sorts files of records containing
21.Xr refer
22key-letters by user-specified keys.
23Records may be separated by blank lines,
24or by
25.Ql \&.[
26and
27.Ql \&.]
28delimiters,
29but the two styles may not be mixed together.
30This program reads through each
31.Ar database
32and pulls out key fields, which are sorted separately.
33The sorted key fields contain the file pointer,
34byte offset, and length of corresponding records.
35These records are delivered using disk seeks and reads, so
36.Nm sortbib
37may not be used in a pipeline to read standard input.
38.Pp
39Option available:
40.Bl -tag -width 4n
41.It s
42By default,
43.Nm sortbib
44alphabetizes by the first %A and the %D fields,
45which contain the senior author and date.
46The
47.Fl s
48option is used to specify new
49.Ar KEYS .
50For instance,
51.Fl s Ns Ar ATD
52will sort by author, title, and date,
53while
54.Fl s Ns Ar A+D
55will sort by all authors, and date.
56Sort keys past the fourth are not meaningful.
57.El
58.Pp
59No more than 16 databases may be sorted together at one time.
60Records longer than 4096 characters will be truncated.
61.Pp
62.Nm Sortbib
63sorts on the last word on the %A line,
64which is assumed to be the author's last name.
65A word in the final position, such as ``jr.'' or ``ed.'',
66will be ignored if the name beforehand ends with a comma.
67Authors with two-word last names or unusual constructions
68can be sorted correctly by using the
69.Xr nroff
70convention ``\e0'' in place of a blank.
71A %Q field is considered to be the same as %A,
72except sorting begins with the first, not the last, word.
73.Nm Sortbib
74sorts on the last word of the %D line, usually the year.
75It also ignores leading articles (like ``A'' or ``The'')
76when sorting by titles in the %T or %J fields;
77it will ignore articles of any modern European language.
78If a sort-significant field is absent from a record,
79.Nm sortbib
80places that record before other records containing that field.
81.Sh SEE ALSO
82.Xr refer 1 ,
83.Xr addbib 1 ,
84.Xr roffbib 1 ,
85.Xr indxbib 1 ,
86.Xr lookbib 1
87.Sh AUTHORS
88Greg Shenaut, Bill Tuthill
89.Sh BUGS
90Records with missing author fields
91should probably be sorted by title.
92.Sh HISTORY
93The
94.Nm
95command appeared in
96.Bx 4.2 .
97