From owner-freebsd-questions@FreeBSD.ORG Fri Oct 27 04:59:47 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8383C16A407 for ; Fri, 27 Oct 2006 04:59:47 +0000 (UTC) (envelope-from lane@joeandlane.com) Received: from elasmtp-mealy.atl.sa.earthlink.net (elasmtp-mealy.atl.sa.earthlink.net [209.86.89.69]) by mx1.FreeBSD.org (Postfix) with ESMTP id 12E4B43D5C for ; Fri, 27 Oct 2006 04:59:41 +0000 (GMT) (envelope-from lane@joeandlane.com) Received: from [66.47.111.183] (helo=joeandlane.com) by elasmtp-mealy.atl.sa.earthlink.net with asmtp (Exim 4.34) id 1GdJoi-0005Gp-Ez for freebsd-questions@freebsd.org; Fri, 27 Oct 2006 00:59:40 -0400 Received: from joeandlane.com (localhost.localnet.local [127.0.0.1]) by joeandlane.com (8.13.8/8.13.1) with ESMTP id k9R52OXL000478 for ; Fri, 27 Oct 2006 00:02:24 -0500 (CDT) (envelope-from lane@joeandlane.com) Received: from localhost (localhost [[UNIX: localhost]]) by joeandlane.com (8.13.8/8.13.1/Submit) id k9R52O3I000476 for freebsd-questions@freebsd.org; Fri, 27 Oct 2006 00:02:24 -0500 (CDT) (envelope-from lane@joeandlane.com) From: Lane To: freebsd-questions@freebsd.org Date: Fri, 27 Oct 2006 00:02:23 -0500 User-Agent: KMail/1.9.3 References: <574f7c8f130196ac795de5b950d3dcca@prodigy.net> In-Reply-To: <574f7c8f130196ac795de5b950d3dcca@prodigy.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200610270002.23944.lane@joeandlane.com> X-CD-SOLUTIONS-MailScanner-Information: Please contact the ISP for more information X-CD-SOLUTIONS-MailScanner: Found to be clean X-CD-SOLUTIONS-MailScanner-From: lane@joeandlane.com X-ELNK-Trace: e56a4b6ca9bdfda11aa676d7e74259b7b3291a7d08dfec79d92be218527f74e8d58dd86f13277c23350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 66.47.111.183 Subject: Re: altering text files. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2006 04:59:47 -0000 On Thursday 26 October 2006 23:38, jekillen wrote: > 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 > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org" Jeff, man sed is your friend. awk is awkward, but it may be useful as well lane