Delete a line from multiple files

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
yempee
Forum Newbie
Posts: 6
Joined: Sat Oct 24, 2009 5:56 am

Delete a line from multiple files

Post 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.
User avatar
Grizzzzzzzzzz
Forum Contributor
Posts: 125
Joined: Wed Sep 02, 2009 8:51 am

Re: Delete a line from multiple files

Post by Grizzzzzzzzzz »

you can adapt what i wrote in this post

viewtopic.php?f=1&t=108731

to what you need
Post Reply