Im using a cool program in terminal but it’s pre-compiled… Luckily all I need is the output of this system, but the way I need it is tricky… I need it to run normally but output the last line of text in the window to a text file. I jabs been looking around but people only make it so that I can log the whole thing, not just the last line.
it is a compiled unix executable that can’t be run with something like that because it needs to keep running and won’t stop until stopped, and that didn’t work
You can use the
tailcommand to only capture the lastnlines of a file or a stream. For example, to run./myProgrambut only display the last line of output:This pipes (
|) the output of your program into the input oftail, which discards everything except the lastnlines.To save that output to a file instead, you can redirect (
>)tail‘s output to a file: