(in-package :common-lisp-user) (with-open-file (input "~/src/logon/uio/wescience/gml/all.gml") (loop with splits = '(1000000500010 1000001800010 1000002500010 1000003000010 1000003300010 1000003900010 1000004400010 1000005100010 1000005800010 1000006600010 1000007200010 1000007800010 1000008600010 1000009100010 1000009800010) with i = 1 with output = (open (format nil "/tmp/~2,'0d.gml" i) :direction :output :if-exists :supersede) for line = (read-line input nil nil) while line do (let ((id (ignore-errors (parse-integer line :start 1 :junk-allowed t)))) (when (and id (member id splits :test #'=)) (close output) (incf i) (setf output (open (format nil "/tmp/~2,'0d.gml" i) :direction :output :if-exists :supersede))) (format output "~a~%" line))))