You mention that above works locally, which I doubt very much.
This construct will not work, you'll end up with an empty file:
Code:
awk '{ print $5 }' /tmp/eth0file | head -1 > /tmp/eth0file
The reason for this is that bash will look at the whole command, sees that the output is redirected to a file called eth0file and creates this file (now empty). Then the awk part is executed, which uses the same file as input, but it is now empty.
As a rule: Never use the same file name as input and output.
A possible solution for your problem:
Code:
#/bin/bash
ssh root@10.201.7.183 "\
ifconfig eth0 | awk '/eth0/ { print \$5 }' > /tmp/eth0file ; \
ifconfig eth1 | awk '/eth1/ { print \$5 }' > /tmp/eth1file ; \
ifconfig eth2 | awk '/eth2/ { print \$5 }' > /tmp/eth2file"