Hello I am searching some script or program which use key phrases or pattern search in files ex. php, html, etc and show where's this file

I personally use command cat /home/* grep "keyword" however i must many folders and files which command causes large uptime :/

I want this script to locate fake websites (paypal, ebay, etc)

find /home -professional grep -s "keyword"   -print

You do not really say what OS (and spend) you're using. You might like to retag your question to assist us out.

Since you mention cat ... , I'm presuming you're utilizing a Unix/Linux variant, so here are a few pointers for searching at files. (bmargulies option would be good too).

I am searching some script or program which use key phrases or pattern search in files

grep may be the fundamental program for searching files for text strings. Its usage is

grep [-options] 'search target' file1 file2 .... filen

(Observe that 'search target' consists of an area, if you do not surround spaces inside your searchTarget with double or single quotes, you'll have a minor error to debug.)

(Also observe that 'search target' may use an array of wild-card figures, like .,?,+,,., and much more, that's past the scope of the question). ... anyway ...

When I guess you've discovered, you are able to only cram a lot of files at any given time in to the comand-line, even if using wild-card filename expansion. Unix/linux usually have a utiltiyt that will help with this,


find $ -print  xargs grep -l 'Search Target'

This, as you person will gladly help remind you, will need further improvements in case your filenames contain whitespace figures or newlines.

The choices readily available for grep can differ extremely according to which OS you're using. If you are lucky, you type the next to find the guy page for the local grep.

guy grep

Without having your page buffer setup for any large size, you will need to complete

guy grep  page

to help you see the top 'document'. Press any answer to advance to another page and when you're in the finish from the document, the final key press returns you to definitely the command prompt.

Some options that many greps have that could be helpful for you are

-i (ignore situation)

-l (list filenames only (where txt is located)

There's also fgrep, that is usually interpretted to mean 'file' grep becuase you are able to provide personal files of search targets to scan for, and it is used like

fgrep [-other_options] -f srchTargetsFile file1 file2 ... filen

I want this script to locate fake websites (paypal, ebay, etc)

Final solution

you may make a srchFile like

paypal.fake.com ebay.fake.com etc.fake.com

after which coupled with above, run the next


find $ -print  xargs fgrep -il -f srchFile

Some greps require the -fsrchFile be run together.

You now have found all files beginning /home, searching with fgrep for paypay, ebay, etc in most files. The -l states it'll ONLY print the filename in which a match is located. You are able to take away the -l and you might find the output of what's found, prepended using the filename.

I really hope this can help.

P.S. while you seem like new user, if you achieve a solution that can help you please make sure to measure the level as recognized, and/or provide a + (or -) like a helpful answer.