Forum Moderators: bakedjake
I can easily run
locate /wp-includes/version.php What I really want to do is find the actual domain name and the version of Wordpress being run so I know which sites need an upgrade.
Forgive me if I'm being dense about this, but here goes.
What I have now is a text file that looks like this.
...
site3
site34
site35
site37
...
I want to run through that list and grep that sitenum from the /etc/virtualhosting/mappings/domainmap so I can get the actual domain names. What's happening to me though, is that when the shell script greps for "site3" it's also finding site31, site32, site33 and so on.
My shell script is very simple and isn't at all accomplishing what I intended. I know there's a better way to do it, but I'm not a programmer!
This is what I have now:
for i in `cat sitenums`;
do
grep -F $i /etc/virtualhosting/mappings/domainmap;
done
Does anyone have a better idea about how I should do this?
Any suggestions will be greatly appreciated.
Thanks!
Beth
for i in `cat sitenums`;
do
grep $i[^0-9] /etc/virtualhosting/mappings/domainmap;
done
The $i[^0-9] should match any line that contains the output of the sitenums file not followed by a number.
I've run a test and it seems to work:
[root@TEST htdocs]$ cat test2.txt
site3
[root@TEST htdocs]$ cat test3.txt
site3 alpha
site31 beta
site32 charle
site33 delta
[root@TEST htdocs]$ cat shell.txt
for i in `cat test2.txt`;
do
grep $i[^0-9] test3.txt;
done
[root@TEST htdocs]$ ./shell.txt
site3 alpha
It has a command line tool
sitelookup
run
sitelookup -a domain
to get a list of all domains
Maybe something like this will work:
sites=`sitelookup -a site_root¦sort`;for s in $sites;do find $s/var/www/html -type d -name wp-includes;done
That's a pipe to sort...to put them in alphabetical order for you.