I have a perl program that prints to stdout
, which I then pipe into a file, like this:
./skript.pl > file.txt 2>&1
This makes the output of that skript buffer. However, I would like to be able to see what the skript is working on at the moment, so I am trying to find a way to enable line buffering in this setup, so that output is printed as soon as a \n
appears. (This is the normal behaviour if I just print to the terminal.)
I need a solution that is available without installing anything on CentOS.
Changing stuff inside the perlscript is an option. I already tried $|
, but that is doing more than I want: it messes up the cat file.txt
output if the end of the current line is not printed yet.