I need to redirect the output to a file and add the date and time. I try this:
make all | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; }' > file
I expect:
2011-12-13 15:00:50 compilation.... 2011-12-13 15:00:52 still compilation 2011-12-13 15:00:55 compilation ...
How can i do this? If I delete the "> file" on the screen, I see the correct output. But I will redirect this to a file.
Can someone help me?
source share