Hi All,

I need some help in searching string in a file.

My requirement is to search the string,append something to the string .
Write the string back to the file without changing other parts of the file.

e.g  
Suppose I have the following string in a file 


Set-Cookie: T_COOKIE=127.0.0.1-saswat-9; path=/


The fixed string is "Set-Cookie: T_COOKIE="and rest of the string is variable.
I would like to change the string "127.0.0.1-saswat-9"  to say
"127.0.0.1-saswat-9-1234"

My constraint is : I don't want to read the whole file into a buffer
and work on that buffer as the file can be very large , sometimes more
than 10 mb.

My advantage is : I know that I will get the search string in first
200 bytes of the file , so I just need to read 200 bytes,play with
that and write it back (overwriting the first 200 bytes with new 200
some bytes) ..

Would appreciate any help or pointers.

Thanks,
-Saswat

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to