Hi guys,
does somebody know some simple script how to cut blocks of strings between matchihg words in a text file?
I have this:
$file = ("path to the file")
$word1 = "HEAD" ;
$word2 = "FOOT" ;
$handle = fopen($file, "r");
$contents = fread($handle, filesize($file));
fclose($handle);
$between=substr($contents, strpos($contents, $word1), strpos($contents, $word2) - strpos($contents, $word1));
echo $between ;
I have in the text more than 10 blocks startin and ending with these words and my task is to cut some of them and to write the result into a new file.
Any suggestions?
Help will be appreciated.
Cheers,
M.
does somebody know some simple script how to cut blocks of strings between matchihg words in a text file?
I have this:
$file = ("path to the file")
$word1 = "HEAD" ;
$word2 = "FOOT" ;
$handle = fopen($file, "r");
$contents = fread($handle, filesize($file));
fclose($handle);
$between=substr($contents, strpos($contents, $word1), strpos($contents, $word2) - strpos($contents, $word1));
echo $between ;
I have in the text more than 10 blocks startin and ending with these words and my task is to cut some of them and to write the result into a new file.
Any suggestions?
Help will be appreciated.
Cheers,
M.