Terminal redirection: ascii text, with cr, lf line terminators, with overstriking

MacOS 12.6 (running on Apple M1 Ultra) terminal redirection to a file generates ascii text, with cr, lf line terminators, with overstriking, while running my code with TensorFlow-metal(0.5.1) with Tensorflow-macos(2.9.2) as below:

^M1/1 [==============================] - ETA: 0s^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^M1/1 [==============================] - 1s 943ms/step

When I checked the file type, I get the following: (base) bapikar@Bapis-Mac-Studio % file tmp.log           

tmp.log: ASCII text, with CR, LF line terminators, with overstriking

I was expecting it as: tmp.log: ASCII text

Please help. Thanks

Just to add, I see nothing of these characters while running with TF-MACOS=2.8.0 and TF-METAL=0.4.0 for python=3.8.13 env.

It sounds like whatever code you’re using to write this text isn’t detecting that the output is a file and suppress its ‘smarts’. It’s traditional to use the isatty function for this; for the details, see its man page.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Terminal redirection: ascii text, with cr, lf line terminators, with overstriking
 
 
Q