Re: Search and replace a String in a file.
| From: | Justin Patrin | Date: | Thu, 24 Jun 2004 17:18:06 +0000 |
| Subject: | Re: Search and replace a String in a file. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-188978@lists.php.net to get a copy of this message | ||
There's a PEAR package for just this. :-)
http://pear.php.net/package/File_SearchReplace
On Thu, 24 Jun 2004 12:58:08 -0400, Eric L. Sammons <esammons@vt.edu> wrote:
>
> Being new to PHP this task seems to be little out of my reach right now. I
> wonder if anyone could tell me how, as I read a file, line by line, search for
> and then replace a given string?
>
> The lines in the file will appear as such:
>
> Summary: Some Summary
> Name: Some-Name
> Version: x.x
> .
> .
> .
>
> Basically I will open the file, read its lines one by one and I want to
> replace Some-Name with Some-other-Name.
>
> Thank you!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
paperCrane --Justin Patrin--