Goal: I want to find some text called mytext within all php files in a directory. I also want to display all the matches and highlight them.
If this is what you want try this:
grep -Hin "mytext" *.php | less +/mytext
Goal: I want to find some text called mytext within all php files in a directory. I also want to display all the matches and highlight them.
If this is what you want try this:
grep -Hin "mytext" *.php | less +/mytext
To find syntax errors in all php pages within a directory called /var/www/html, use the following command:
find /var/www/html -name '*.php' -type f -exec php -l {} \;
Have a big website with millions of records? Is MySQL full-text search letting you down? Sphinx search http://sphinxsearch.com by Andrew Aksyonoff is probably gonna solve your problems. It is an awesome product (and yes it’s open source) with less than a second search results on a data set with millions of records.
I had the opportunity to author a sphinx based search engine for vBulletin. We use it for our huge forums at Internet Brands. A demo can be viewed here:
From the man watch page: “The -d or --differences flag will highlight the differences between successive updates.”
Try
watch -d -n 3 "free -m"
The above command would highlight the differences in memory consumption every 3 seconds.
I tried a 256 MB slice (that’s what they call a cloud) with Slicehost, a rackspace company, and the guys are AWESOME! Shortly after that, rackspace came up with rackspacecloud.com (they had slicehost, why would they? who cares
), and I have been a big big fan of rackspace. So, I decided to give rackspacecloud.com a shot. Same memory, same disk space, same everything (well I haven’t really needed rackspacecloud.com support that often) and close to half the price.
256 MB on slicehost = $20 vs 256 MB on rackspacecloud.com = $11 approximately (for me atleast)
Doesn’t quite make sense to me
Check out my post on migrating website content here: http://priteshjshah.com/?page_id=42
the -v switch is used to return negative results. So, to find everything which does not contain “findme” use
cat filename | grep -v "findme"
To find and replace “findme” with “replacewithme” in all HTML files in a directory /var/www/html use
find /var/www/html -name '*.html' -print0 |xargs -0 perl -p -i -e 's/findme/replacewithme/g'
To find and replace “findme” with “replacewithme” in all HTML files in a directory /var/www/html and to backup the original files as let’s say filename.unixtimestamp use
find /var/www/html -name '*.html' -print0 |xargs -0 perl -p -i.`date +%s` -e 's/findme/replacewithme/g'