加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

bash – 仅将STDOUT的最后一行重定向到文件

发布时间:2020-12-16 01:16:50 所属栏目:安全 来源:网络整理
导读:我正在编译 Scala代码并在文件中写出输出控制台输出.我只想在文件中保存STDOUT的最后一行.这是命令: scalac -Xplugin:divbyzero.jar Example.scala output.txt scalac -Xplugin:divbyzero.jar Example.scala的输出是: helex@mg:~/git-repositories/my_plu
我正在编译 Scala代码并在文件中写出输出控制台输出.我只想在文件中保存STDOUT的最后一行.这是命令:
scalac -Xplugin:divbyzero.jar Example.scala >> output.txt

scalac -Xplugin:divbyzero.jar Example.scala的输出是:

helex@mg:~/git-repositories/my_plugin$scalac -Xplugin:divbyzero.jar Example.scala | tee -a output.txt
You have overwritten the standard meaning
Literal:()
rhs type: Int(1)
Constant Type: Constant(1)
We have a literal constant
List(localhost.Low)
Constant Type: Constant(1)
Literal:1
rhs type: Int(2)
Constant Type: Constant(2)
We have a literal constant
List(localhost.High)
Constant Type: Constant(2)
Literal:2
rhs type: Boolean(true)
Constant Type: Constant(true)
We have a literal constant
List(localhost.High)
Constant Type: Constant(true)
Literal:true
LEVEL: H
LEVEL: H
okay
LEVEL: H
okay
false
symboltable: Map(a -> 219 | Int | object TestIfConditionWithElseAccept2 | normalTermination | L,c -> 221 | Boolean | object TestIfConditionWithElseAccept2 | normalTermination | H,b -> 220 | Int | object TestIfConditionWithElseAccept2 | normalTermination | H)
pc: Set(L,H)

我只想保存pc:在输出文件中设置(L,H)而不是其余部分.在哪个命令的帮助下,我可以实现我的目标?

只需将stdout通过tail -n 1传递给你的文件

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读