lazydev
1
I am executing df -mP to see the disk utilization.
I would like to append servername also to each and every line.
df -mP | awk '{ print $1","$2","$3","$4","$5","$6 }'
trying to add something like this
df -mP | awk '{ print $1","$2","$3","$4","$5","$6","$hostname }'
to get the hostname along with the output but could not succeed .
Need help on this
Try:
df -mP | awk -v hostname="$(hostname)" '{print $1","$2","$3","$4","$5","$6","hostname}'