val src = Source fromFile "<your file name>"val splitLines = src.lines map (_ split " ") // is an Iterator[Array[String]]
val output = splitLines map { fields => fields(0) + "/" + fields(2) } // is an Iterator[String]
output forEach println
src.close()
Just be wary of the iterators here. Instead of attempting to load the entire file into memory, lines will be parsed on demand. This is great for performance and memory pressure, but also means that you must be careful to only close the source after you’ve finished processing it.
You’ll also want to avoid using those iterators more than once, they’ll already be consumed after the first use…