Append to a file repeating output

Hello,

i'm trying to force a command to read every second from an interface

watch  -n1 (command) /dev/x | cat  >> output

but it continue to overwrite the file, without append the content

Thanks and advace for help as usual

regards

What does command do to the output file? You know that that cat is unnecessary?

hello,

just write 4 columns of raw data, like a timestamp and numbers. Yes i've tried also without it and without the pipe using just >> , again still the same.

Thank you

So - why did you put it back in?

watch seems to do funny things to your output file, e.g. writing many console code/control chars. You should have seen it grow during operation.

Place the whole command to watch within single coma.

watch  -n1 'command /dev/x | cat  >> output'

However, the command cat it not necessary there.

watch  -n1 'command /dev/x >> output'
2 Likes