Unix redirect tail to file

I store data from nc output in a file 24 hours a day. This is a temperature recorder. This file amroutputwill be very large over time. (Every 10 seconds in a row). For one application, I will have the last entry in the file amr_last_output. Therefore, I use:

 tail -f -n1 amroutput > amr_lastoutput.

With >I will overwrite the file amr_lastoutputevery time tal makes a conclusion. On mac osx, we output tail output to the output file, as in the command >>. What can I do?

Thanks for answers!

+6
source share
2 answers

I look forward to your confirmation of my previous comment. But at the same time, I am going to approve and give you the proposed solution.

a! → → "noclobber" , :

tail -f -n1 amroutput >! amr_lastoutput

, , - .

0

' > ' . while .

!

0

All Articles