Created
May 4, 2009 04:03
-
-
Save kyleburton/106291 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn dbf->tabfile [dbfile tabfile] | |
(with-open [dbf (org.xBaseJ.DBF. dbfile)] | |
(with-open [outp (java.io.PrintWriter. tabfile)] | |
(binding [*out* outp] | |
(println (str/str-join "\t" (field-names dbf))) | |
(for-each-row | |
(fn [recno fields] | |
(println (str/str-join "\t" (map #(.trim (.get %)) fields)))) | |
dbf))))) | |
(dbf->tabfile | |
(kutils/expand-file-name "~/data-sets/tiger-line/data/tmp/tl_2008_us_state.dbf") | |
(kutils/expand-file-name "~/us_state.tab")) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment