why cant I redirect the output from sed to a file
问题 I am trying to run the following command ./someprogram | tee /dev/tty | sed 's/^.\{2\}//' > output_file But the file is always blank when I go to check it. If I remove > output_file from the end of the command, I am able to see the output from sed without any issues. Is there any way that I can redirect the output from sed in this command to a file? 回答1: Remove output-buffering from sed command using the -u flag and make sure what you want to log isn't on stderr -u, --unbuffered load minimal