Let's have the following code (here in python):
When running it in a console, this correctly produce:
something, the caret returns back to the beginning of the same line, and then overwrite the first four characters with
However, the same command in a redirection will produce:
which is incorrect. Why is it so ? Is there something to tell the shell to rewrite the current line when redirecting ?
About the definition of CR and LF: