Prefix The Output of Any Command with a Timestamp
July 16, 2023 —
Gregg Szumowski
You can prefix the output of every line with a timestamp by piping the command to the following sed command:
$ command | sed "s/^/\[
date +ā%Y%m%d%H%M%Sā]/"