I have many servers like sdeuu1, sdeuu2, sdeuu3,.. etc.
I want to run a query on each one of them and the query is :
grep -i 'SponsoredLinksIFrame.jsp' /home/nextag/httpd_logs/access_log.1360* |
grep -ic 'nextag.co.uk'
this query is returning perfect results when ran on separate servers.
Now i have one server named sdalp1 through which i can ssh to sdeuu1, 2, 3 etc.. and go to that server to run the query. Now instead of doing that i want to run the query from sdalp1 for all the sdeuu servers in one go and i tried the following command and a few other versions of it:
for i in sdeuu1 sdeuu2 sdeuu3 sdeuu4 sdeuu5 \
sdeuu6 sdeuu7 sdeuu8 sdeuu9 sdeuu10 \
sdeuu11 sdeuu12 sdeuu13 sdeuu14 sdeuu15 \
sdeuu16 sdeuu17 sdeuu18; do
grep -i 'SponsoredLinksIFrame.jsp' /home/nextag/httpd_logs/access_log.1360* |
grep -ic 'nextag.co.uk'"
echo $i
done
But this command is returning an error for all servers as follows:
-bash: grep -i 'SponsoredLinksIFrame.jsp' /home/nextag/httpd_logs/access_log.1360* | grep -ic 'nextag.co.uk': No such file or directory
What is the problem here, i am not getting if this is an issue with permissions?
ssh
, e.g.: `ssh sdeuu1 "grep '...' | grep '...'". – Thor Feb 13 '13 at 09:03