1

I am trying to write a log file and output to a console at the same time The below works well. However I have a sleep timer and the logfile counts down each second and fills the log. The "Sleeping for..." is in stdout not in the stderr.

watch_dog > >(tee -a ${LOGFILE}) 2> >(tee -a ${LOGFILE} 2>&1)

I would like to add

grep -v "Sleeping for..."

The console should still dislpay everything. The log file should omit any line that has "Sleeping for..." Any help would be greatly appreciated.

Something like

watch_dog > >(grep -v "Sleeping for..." | tee -a ${LOGFILE}) 2> >(tee -a ${LOGFILE} 2>&1)

or

watch_dog 2>&1 | tee >( grep -v 'Sleeping for...' >${LOGFILE} )

However these don't work

waeking
  • 11
  • Why, and how to work around it: https://unix.stackexchange.com/a/164681/315749; also, what to do if the program you're using doesn't doesn't have options to configure buffering: https://unix.stackexchange.com/q/25372/315749 – fra-san Apr 14 '21 at 20:46

0 Answers0