altering text files.

jekillen jekillen at
Fri Oct 27 04:37:08 UTC 2006

Hello fellow FreeBSD users;

I have a technical question about text files:

Is there a way to edit a text file via a script
by searching and replacing small portions
of a text file, instead of having to rewrite
the whole file for what may be negligible
alterations? I'm assuming not, but I'm not
really sure.

My interest is with any scripting or even
compiled language, but specifically the
use of php to edit files on a web server.

I have created an application for a web
client that allows the client to contact their
site and make changes to a file that lists
event date, title, location, subject. And
creates a separate file for details related
to each event listing. I'm concerned about
allowing the client to edit the listings and
detail files in the event that a mistake is
made in the data entered from a event
posting form. (I don't want to have to
manually edit the files for them in this event)

So, the idea of correcting the spelling of
a word like is when it was spelled  it seems
over kill  (to over write a whole file just to change
one character).

Thanks in advance;
Jeff k

More information about the freebsd-questions mailing list