How do I find text inside php?
April 23, 2008 5:11 AM   Subscribe

Is there a program that will do a deep text search inside php and html files?

I have to find a certain text line inside hundreds of php and html files on my computer.
I've already used Total Commander and Windows Grep (I have no clue.. just found it while I was searching for an answer) and so far it's not turned up anything at all.
Anyone know of a program that could help out?
posted by czechmate to Computers & Internet (23 answers total) 1 user marked this as a favorite
 
UltraEdit, my preferred editor, will find in files. There's a free trial.
posted by phearlez at 5:18 AM on April 23, 2008


Have you tried using a 'Find in Files' on an slight more advanced than Notepad text editor?

I've used Ultra-Edit quite succesfully for this before..

I'm sure there are freeware ones floating about too.


oooh.. beaten on Preview. Bravo phearlez.
posted by moocheen at 5:20 AM on April 23, 2008


Dreamweaver will also do this, although I wouldn't recommend buying a copy just for that...
posted by le morte de bea arthur at 5:22 AM on April 23, 2008


grep will do it too, you just have to take the time to learn to use it. If you interested in learning how UNIX works anywayit might be worth it. You can install cygwin, which is like a mini UNIX environment hat runs in a box on windows.

Something like:
find . | xargs grep -i searchterm
would do it.
posted by meta_eli at 5:34 AM on April 23, 2008


Tell us what operating system is on your computer.
posted by bricoleur at 6:00 AM on April 23, 2008


If Windows Grep isn't finding it, you're either using it wrong, or it isn't there.
posted by Jairus at 6:35 AM on April 23, 2008


Regardless of your platform, jEdit text editor will work and it has a very powerful yet easy to use search facility.
posted by mmascolino at 6:37 AM on April 23, 2008


On the Mac, I'd recommend TextWrangler.
posted by Wild_Eep at 7:04 AM on April 23, 2008


Windows search looks for text within files. Assuming you have Windows, why not use that?
posted by charlie7691 at 7:10 AM on April 23, 2008


A desktop search program (google Desktop, Windows Desktop Search, Yahoo Desktop Search, X1, Copernic, etc). They may not know to treat PHP as plaintext or even index it by default, but each program allows you to customize which file extensions are indexed as plaintext, or allow for plugins to enable additional file types.
posted by misterbrandt at 7:10 AM on April 23, 2008


the op is using windows. this is based on the names of the applications she says she has already tried to use.

zechmate, when you tried using grep what options did you use? if you are trying to match an exact phrase you may have more luck selecting the "Quick (no regular expressions)" search type.
posted by phil at 7:15 AM on April 23, 2008


Something I've found that seems to work on everything I've thrown at it is
'Agent Ransack' at www.mythicsoft.com/agentransack.

It's very fast. I do account research with it looking for snippits of names or
account numbers. Works well across network links. Been using it for four or
five years.

YMMV

SandPine
posted by sandpine at 7:20 AM on April 23, 2008


I'll second sandpine's suggestion. I use the pro version of Agent Ransack (filelocator pro), but if agent ransack is anything like filelocator pro, it'll be the last search tool you ever need.
posted by isoman2kx at 7:55 AM on April 23, 2008


I use textpad for this. It's equivalent to the other editors mentioned here, so which you use comes down to personal preference.

Here's a screencast of me finding text using textpad.
Note the use of regular expressions.
posted by seanyboy at 8:02 AM on April 23, 2008


grep was the first thing that came to mind. Are you sure it's actually in the file?
posted by devlin at 8:28 AM on April 23, 2008


If Windows Grep isn't finding it, you're either using it wrong, or it isn't there.

nthed.

keep in mind grep *can* be case sensitive. also keep in mind that if you have downloaded these php files from somewhere else, or they're not actually served from your computer, there is a very good chance the line you want to change is sitting in a database somewhere. perhaps if you give us more information about what these files are meant to do, we can help further.

Other advice: search for string fragments rather than the entire string in case it is pieced together over the course of several statements. make sure you're searching recursively through directories.
posted by fishfucker at 9:10 AM on April 23, 2008


BareGrep
posted by klanawa at 9:12 AM on April 23, 2008


I use a great little tool called InfoRapid Search & Replace. You just add the file extensions you want to search, point it to a directory, and go. It will display the instances of the search term in context line by line, and save your searches in tabs. Best of all, it's free!
posted by tjvis at 9:36 AM on April 23, 2008


Without installing anything, you can use the command line tool FINDSTR. I've been using it for years with no issues.
posted by mphuie at 10:52 AM on April 23, 2008


I'd prefer to use cygwin grep myself, but perhaps google desktop search would work better for you?
posted by jenkinsEar at 12:00 PM on April 23, 2008


Response by poster: I went so far as searching just for one word in that string of text using Grep, Commander, UltraEdit, BareGrep, InfoRapid, and it's not finding it. I wanted to make sure it wasn't just one program not being able to find it, so that's why I tried them all. (BareGrep was the nicest. I liked seeing the results as I type them in rather than a box showing progress)
I'm guessing this means it doesn't exist in the files I have. And I have already searched through the MySQL database wondering if the string is there.. and it wasn't there either. I'm not sure where Google is finding this string of text from.

Looks like I'll have to wait a week to ask another question. Heh.

Thanks everyone.
posted by czechmate at 12:57 PM on April 23, 2008


is it showing up in a google result but not showing up on the specific page that google attributes it to?
posted by fishfucker at 8:53 AM on April 24, 2008


Response by poster: Ah. Your question fishfucker actually triggered an idea in my head while I was responding to you.
Google is not pulling the "description" from the website.. it's pulling from the DMOZ entry. I don't understand why it's doing that though. It's really screwing up the optimization of it. But the DMOZ entry is the exact string I've been searching for.
posted by czechmate at 9:37 AM on April 24, 2008


« Older Questions for Mom and Dad   |   A request for help Newer »
This thread is closed to new comments.