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:
scalac
scalac ... | awk 'END{print>>"output.txt"}1'
This will pipe everything through to stdout and append the last line to output.txt.