add time to make output and redirect it to a file

make -j 2>&1 | while IFS= read -r line; do echo "$(date +"%d-%m-%[email protected]%T") $line"; done > make.out
Will prepend date and time in the following format: [email protected]:mm:ss (24hours format) and redirect it to make.out file
Sample Output
[email protected]:42:57 [  7% 2136/28175] Export includes file:  -- out/host/linux-x86/obj/STATIC_LIBRARIES/libunwindbacktrace_intermediates/export_includes
[email protected]:42:57 [  7% 2137/28175] host C: libunwind <= external/libunwind/src/x86_64/Gos-linux.c
[email protected]:42:57 [  7% 2138/28175] host C: libunwind <= external/libunwind/src/x86_64/Lstash_frame.c
[email protected]:42:57 [  7% 2139/28175] Export includes file:  -- out/host/linux-x86/obj/STATIC_LIBRARIES/libcompiler_rt_intermediates/export_includes
[email protected]:42:57 [  7% 2140/28175] Notice file: external/compiler-rt/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//lib64/libcompiler_rt.so.txt
[email protected]:42:57 [  7% 2141/28175] host C: libunwind <= external/libunwind/src/x86_64/Los-linux.c

0
By: redowk
2017-03-06 18:14:51

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: