如何在ls -l命令中单独处理每一行的处理
val cmd = "ls -l"
我想在输出中分别处理每一行。我想过滤输出中有_good的文件名
CMD。!!将所有内容转储为单个字符串
答案 0 :(得分:1)
您想要阅读ProcessBuilder
的scaladoc,其中包含
scala> Process("ls /tmp").lines
warning: there were 1 deprecation warning(s); re-run with -deprecation for details
res2: Stream[String] = Stream(at-spi2, ?)
scala> .toList
res3: List[String] = List(at-spi2, hsperfdata_apm, keyring-Lsl8gb, orbit-apm, pulse-2L9K88eMlGn7, pulse-Hcr7h8tFMGwW, pulse-PKdhtXMmr18n, sbt6769456248604563825.log, sbt_68f5ab55, sbt8158248552881459061.log, ssh-vAcOoXVi2053, tmpBuQ6hF, unity_support_test.0)
包文档也很详细。