author | Christian Urban <christian.urban@kcl.ac.uk> |
Sat, 11 Mar 2023 23:12:49 +0000 | |
changeset 467 | 9b5165b8a762 |
parent 266 | ca48ac1d3c3e |
permissions | -rw-r--r-- |
import io.Source import scala.util._ object Foo { def get_data(symbol: String) : List[String] = Source.fromFile(symbol ++ ".csv")("ISO-8859-1").getLines.toList def process(s: String) : String = { val l = s.split(",").toList l(0) + "," + l(5) } def clean(sym: String) = { val da = get_data(sym) val out = for (l <- da; if l.drop(4).startsWith("-01")) yield process(l) println(process(da.head)) out.foreach { println } } def main(args: Array[String]) = clean(args(0)) }