top -bn1 | grep "Cpu(s)" | \
sed "s/., *([0-9.])%* id.*/\1/" | \
awk '{print 100 - $1"%"}'
The above script is for getting cpu usage in %tage out of 100.
I tried using it but it's throwing error related to invalid syntax specially for ' ' and | characters.
top -bn1 | grep "Cpu(s)" | \ sed "s/., *([0-9.])%* id.*/\1/" | \ awk '{print 100 - $1"%"}'
The above script is for getting cpu usage in %tage out of 100. I tried using it but it's throwing error related to invalid syntax specially for ' ' and | characters.