for i in ` hostname ` ; do
df -k | awk -v i=$i '{print $1, $2, i}'
done
However the df -k part does not work that way, except in some clustered environments.
hostname will give single result, so i will always be the same....
What are you trying to do? What we see does not make clear sense.
Thanks for the quick reply. Ok I just put the command an example.
I am using a different command where it is printing the $1 and $2 fine, I want to add a last column which should be the hostname and should read from the $i ( from the for loop)
example
for i in ` cat serverlist.txt ` ; do
my command | awk '{print $1 $2 $i}'
done
Thank you so much for the info. I will try this one too. Basically I am not using the df -k command , but i just put that here for example but realized later that it is not a right example.