Searching stuff.
Author |
Message |
Apage43
|
Posted: Fri Nov 28, 2003 12:45 pm Post subject: Searching stuff. |
|
|
I want to search a text file for a string. Like a search engine, and want to get the line numbers of all matching lines, what would be the best way to do that? I've used grep to do it, but I think that makes my script OS dependent. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Blade
|
Posted: Mon Dec 01, 2003 3:23 pm Post subject: (No subject) |
|
|
whatif you read each line into an array then search the array for the file and record the element number each word is in? |
|
|
|
|
|
Homer_simpson
|
Posted: Mon Dec 01, 2003 10:31 pm Post subject: (No subject) |
|
|
or make up a function like i made for turing called wordseparator or something that separates the works by space or any other separators... so u can search yer string for words or even sentences.... |
|
|
|
|
|
Blade
|
Posted: Tue Dec 02, 2003 12:24 pm Post subject: (No subject) |
|
|
or you can use a function called explode()
goto http://php.net |
|
|
|
|
|
|
|