diff options
author | Alejandro Colomar <alx@kernel.org> | 2023-08-13 00:34:34 +0200 |
---|---|---|
committer | Alejandro Colomar <alx@kernel.org> | 2023-08-13 01:34:00 +0200 |
commit | a8697ccd5a699f5ad6f446b65266600e7de55a8a (patch) | |
tree | d3f06373b27a76b3b1b43024156ef6d554e819fe /scripts | |
parent | e670e8a62fa884f2aebb445fa8aacf59f4504380 (diff) | |
download | man-pages-a8697ccd5a699f5ad6f446b65266600e7de55a8a.tar.gz |
scripts/sortman: Add script to sort manual pages in book order
`LC_COLLATE=en_US.UTF-8` is needed to collate pages like _exit(3) next
to exit(3), instead of having all pages with a leading underscore
grouped at the beginning of a section.
intro(*), of course, is the fist page of each section, and subsections
go after the last page in the main corresponding section.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/sortman | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/sortman b/scripts/sortman new file mode 100755 index 0000000000..58354567cc --- /dev/null +++ b/scripts/sortman @@ -0,0 +1,12 @@ +#!/bin/sh + +# Copyright 2023, Alejandro Colomar <alx@kernel.org> +# SPDX-License-Identifier: GPL-3.0-or-later + +export LC_COLLATE=en_US.UTF-8; + +sed -E '/\/intro./ s/.*\.([1-8])$/\10\t&/' \ +| sed -E '/\/intro./!s/.*\.([1-8])$/\11\t&/' \ +| sed -E '/\/intro./!s/.*\.([1-8].+)/\1\t&/' \ +| sort \ +| cut -f2; |