Skip to content

Instantly share code, notes, and snippets.

@kyleburton
Created May 4, 2009 04:03
Show Gist options
  • Save kyleburton/106291 to your computer and use it in GitHub Desktop.
Save kyleburton/106291 to your computer and use it in GitHub Desktop.
(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