I'm trying to generate a file to keep the log of average CPU usage.
sudo mpstat 1 5 | grep Average | sed -E 's|Average:|$(date)|g' > cpu_usage_test.txt
I'm trying to replace the text "Average:" with the current date and time. Tried different ways but in output, it is displaying $(date) as a string. To test it easily, use the following command to display it on the terminal itself.
sudo mpstat 1 1 | grep Average | sed -E 's|Average:|$(date)|g'