script to get file size

I just tried with the code...initially it gave me some syntax errors and I could resolve it. but I'm getting only ipaddress.
Here is the code again...

for host in 111.111.111.1111 222.222.222.222; do
ssh $host 'ls -l /some/path/*.txt' | awk '$5 > 40959 { print "'"$host"'";$0 }'
done >file.txt

Thanks again.

You should have a colon, inside the double quotes, not a semicolon outside them.

thanks...it works ..

for host in 111.111.111.1111 222.222.222.222; do
ssh $host 'ls -l /some/path/*.txt' | awk -v h=$host '  {if ($5 > 40959) { print h, $0 }}'
done >file.txt


Thanks for your reply..

Since I can only run this script from where script is located at the moment, Is it possible to run this script from anyware. I mean anyware under the root . Thanks

There is nothing which confines this script to a particular directory. The output file will be created in the directory where it runs but just add an absolute path to the redirection done >/path/to/file.txt if you think that's a problem.