I'm trying to run a server that writes to $log (a txt file) and then find all the text in the logfile that starts with [1] and put it in another file. Here's my attempt. tee -a $log
works along with everything else. The grep command doesn't though.
run="tail -n0 -f -s 0.01 $cmds | (while true; do $tron --userconfigdir $userconfigdir --userdatadir $userdatadir --vardir $var; done) | tee -a $log | grep '^\[1\]' > ${var}logs/chatlogs.log"
What can be done to copy all the text from tee -a $log
starting with [1] to another file?
It is normally fine to do this:
Naturally, you only need tee if you wish to have console output as well as copying to file. If you are starting and stopping this process you may want to pass the
-a
switch to tee.What did you get when running it?
Try the alternative: