Skip to content

Instantly share code, notes, and snippets.

@Yuichiroh
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yuichiroh/0f3ca88613829d462373 to your computer and use it in GitHub Desktop.
Save Yuichiroh/0f3ca88613829d462373 to your computer and use it in GitHub Desktop.
reset {
val w1 = shift { (cont: PrintWriter => Unit) =>
using(new PrintWriter("col1.txt"))(cont)
}
val w2 = shift { (cont: PrintWriter => Unit) =>
using(new PrintWriter("col2.txt"))(cont)
}
Console.err.println("A")
Source.stdin.getLines().map(_.split("\t")).foreach {
case Array(col1, col2, _*) =>
w1.println(col1)
w2.println(col2)
case Array(col1) => w1.println(col1)
}
Console.err.println("B")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment