/usr/bin/s9cols is in scheme9 2015.11.19-1build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | #! /usr/bin/s9 -f
; cols -- format input in two columns
; by Nils M Holm, 2010
; Placed in the Public Domain
;
; Usage: cols [-l] [-s separator] [file ...]
(load-from-library "parse-optionsb.scm")
(load-from-library "displaystar.scm")
(load-from-library "read-file.scm")
(load-from-library "split.scm")
(load-from-library "appendb.scm")
(define pad-left  (option #\l #f))
(define separator (option #\s 'string " "))
(define show-help (option #\h #f))
(define options   `(,pad-left
                    ,separator
                    ,show-help))
(define (pad k s)
  (make-string (- k (string-length s)) #\space))
(define (cols)
  (let* ((col* (split (read-file)))
         (kl   (apply max (cons 0 (map string-length (car col*)))))
         (kr   (apply max (cons 0 (map string-length (cadr col*))))))
    (if (> (length (car col*))
           (length (cadr col*)))
        (if (null? (cadr col*))
            (set-car! (cdr col*) '(""))
            (append! (cadr col*) '(""))))
    (for-each (lambda (left right)
                (if (opt-val pad-left)
                    (display* (pad kl left)
                              left
                              (opt-val separator)
                              (pad kr right)
                              right
                              #\newline)
                    (display* left
                              (pad kl left)
                              (opt-val separator)
                              right
                              (pad kr right)
                              #\newline)))
              (car col*)
              (cadr col*))))
(define (usage)
  (display "Usage: cols [-l] [-s separator] [file ...]")
  (newline))
(let ((files (parse-options! (sys:command-line) options usage)))
  (if (opt-val show-help)
      (begin (display-usage
               `(""
                 ,usage
                 ""
                 "Format input in two columns"
                 ""
                 "-l         pad on the left (default: right)"
                 "-s string  column separator (default: \" \")"
                 ""))
      (sys:exit 0)))
  (if (null? files)
      (cols)
      (let loop ((files files))
        (if (not (null? files))
            (begin (with-input-from-file
                     (car files)
                     cols)
                   (loop (cdr files)))))))
 |