Prefix time to each line of bash command output
- by neildeadman
I am running the top command to see details about specific processes. The output is piped to grep like so:
top -n 1 | grep jre
The output is usually around 4 lines, and I would like to prefix the current time to each line so it would be something like:
Before:
2772 deleteme 20 0 2832 1156 872 R 2.0 0.1 0:00.01 top
After:
13:46 25-08-2012 2772 deleteme 20 0 2832 1156 872 R 2.0 0.1 0:00.01 top