Hi,

untested but:

(require '[clojure.string :as str])

(with-open [reader (clojure.java.io/reader "path/to/the/file")]
   (let [lines (line-seq reader)
         records (map #(str/split % #"\/\/") lines)]
     ... do your processing here on the lazy record list
    ))

L
2012/6/21 Joseph Guhlin <joseph.guh...@gmail.com>

> I have a 2.5GB file, and will have other files, where the records are
> mutli-line (variable length) and are separated by // on a line by itself.
> What is the best way to read the record into a sequence of strings for
> parsing, and act on that record, and read the next record? It'd be great if
> it was lazy, as it's 2.5GB and there will be other / larger files in the
> future.
>
> I have it reading the file just fine if there is only one entry, it was
> nice and easy as well as fast and concise, so I'd love to be able to do the
> entire thing in clojure if possible.
>
> Thanks,
> --Joseph
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en




-- 
László Török

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to