Page 1 of 1

Delete a line from multiple files

Posted: Mon Nov 09, 2009 9:29 am
by yempee
Hi All,

I have a folder which contains 100 text files.
I want to have a PHP script which will read these files one by one and search for the string "i am the best".
If any files that contains the string "i am the best",the script should delete the entire line which contains the string "i am the best" from that file.
At the end of the script execution i should see all the files which does not have the string "i am the best" in it.

Can anyone plz help me

Thanks in advance.

Re: Delete a line from multiple files

Posted: Mon Nov 09, 2009 9:47 am
by Grizzzzzzzzzz
you can adapt what i wrote in this post

viewtopic.php?f=1&t=108731

to what you need