2013/08/31

sed じゃなくて awk だよね

(ql:quickload :info.read-eval-print.sed)
(ql:quickload :trivial-shell)

(use-package :info.read-eval-print.sed)

(let ((odd-total 0)
(even-total 0))
(with-input-from-string (in (trivial-shell:shell-command "ls -l /tmp"))
(sed (:in in :n t)
(when ($ 5)
(let (($5 (parse-integer ($ 5))))
(if (oddp (parse-integer ($ 2)))
(incf odd-total $5)
(incf even-total $5))))))
(values odd-total even-total))

0 件のコメント: