I want to create a log file for my python script. I have already used print to debug the script. Since it is a large file, it is difficult to re-edit the print with date.
So I need to redirect the print to a file with the printing date and time. I have already used the command
python -u test.py | sed -u "s/^/`date +'[%a %b %d %k:%M:%S]'` /" >> test.log
But this command prepends the date at which it is run. It's not the printing time.
I need to have a file with the printing time not the time at which the script is run.