; filefilter1.scm -
(load "readintolist1.scm")
(define (get-rollup line)
(string->number (regexp-replace* " " (substring line 0 4) "0") 10))
; for fields padded with spaces, replace spaces with zeroes
(define (unpad-number field)
(regexp-replace* " " field "0"))
(define (add-crlf line)
(string-append line (string #\return #\newline) ))
(define (filter-file-rollup threshhold infilename outfilename)
(let ((in-port (open-input-file infilename))
(out-port (open-output-file outfilename 'replace)))
(read-test-write threshhold in-port out-port) ))
(define (read-test-write threshhold in-port out-port)
(let ((line (read-line in-port)))
(cond
((eof-object? line) (void))
(else
(let ( (rollup (get-rollup line)) )
;(display (format "~%rollup: ~A" rollup))
(if (>= rollup threshhold)
(display (format "~A" (add-crlf line)) out-port))
(read-test-write threshhold in-port out-port) )))))
;---------------------------------------------------------------------
; run program:
(filter-file-rollup 10 "dirlisting2.txt" "temp.txt")
(file-reverse "temp.txt" "dirlisting_10.txt")
(filter-file-rollup 100 "dirlisting2.txt" "temp.txt")
(file-reverse "temp.txt" "dirlisting_100.txt") Text file Source (historic): geocities.com/soho/square/3472
geocities.com/soho/squaregeocities.com/soho
(to report bad content: archivehelp @ gmail)
|
|
|
|
|