But here's CLojres read a file line by line and print it out:
C:\\foo.txt
"THis is line 1
This is line 2
This is line 3"
(with-open [rdr (io/reader "C:\\foo.txt")]
(doall (map println (line-seq rdr))))
=>THis is line 1
This is line 2
This is line 3
A simple function to read a specified file line by line (defn read-file-line-by-line [file-path]
(with-open [rdr (io/reader file-path)]
(doall (line-seq rdr))))
(read-file-line-by-line "C:\\foo.txt")
=> ("THis is line 1" "This is line 2" "This is line 3")
To read the line by line and convert them to upper case (map clojure.string/upper-case (read-file-line-by-line "C:\\foo.txt"))
=> ("THIS IS LINE 1" "THIS IS LINE 2" "THIS IS LINE 3")