title: Redirect only the last line of STDOUT to a file
body: <p>I'm compiling Scala code and write the output console output in file. I only want to save the last line of the STDOUT in a file. Here is the command:</p>
  
  <pre><code>scalac -Xplugin:divbyzero.jar Example.scala &gt;&gt; output.txt
  </code></pre>
  
  <p>The output of scalac -Xplugin:divbyzero.jar Example.scala is:</p>
  
  <pre><code>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 -&gt; 219 | Int | object TestIfConditionWithElseAccept2 | normalTermination | L, c -&gt; 221 | Boolean | object TestIfConditionWithElseAccept2 | normalTermination | H, b -&gt; 220 | Int | object TestIfConditionWithElseAccept2 | normalTermination | H)
  pc: Set(L, H)
  </code></pre>
  
  <p>And I only want to save pc: Set(L, H) in the output file and not the rest. With the help of which command I can achieve my goal?</p>