From owner-freebsd-questions@FreeBSD.ORG Fri Feb 18 18:43:08 2005 Return-Path: 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 B8F0C16A4CF for ; Fri, 18 Feb 2005 18:43:08 +0000 (GMT) Received: from ritamari.vonostingroup.com (ip193-230.digitalrealm.net [216.144.193.230]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2BC8943D45 for ; Fri, 18 Feb 2005 18:43:08 +0000 (GMT) (envelope-from laszlof@tvog.net) Received: from adsl-68-72-248-38.dsl.sfldmi.ameritech.net ([68.72.248.38] helo=tvog.net) by ritamari.vonostingroup.com with esmtpa (Exim 4.44 (FreeBSD)) id 1D2D6A-0000VJ-RW; Fri, 18 Feb 2005 13:43:30 -0500 Message-ID: <42163738.5090007@tvog.net> Date: Fri, 18 Feb 2005 13:43:04 -0500 From: Frank Laszlo User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bill Moran References: <421622B0.9030600@ccstores.com> <42162874.6060304@tvog.net> <20050218130558.202a081b.wmoran@potentialtech.com> In-Reply-To: <20050218130558.202a081b.wmoran@potentialtech.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ritamari.vonostingroup.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [26 6] X-AntiAbuse: Sender Address Domain - tvog.net X-Source: X-Source-Args: X-Source-Dir: cc: fquest@ccstores.com cc: freebsd-questions@freebsd.org Subject: Re: need help with script and sed X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Feb 2005 18:43:08 -0000 Bill Moran wrote: >Frank Laszlo wrote: > > >>Jim Pazarena wrote: >> >> >> >>>I would like to traverse my /users/home tree searching >>>for all regular files and change any lines which read: >>> "/cgi-bin/Count.cgi ..." to: >>> "http://counter.qcislands.net/cgi-bin/Count.cgi ..." >>> >>>I kinda think that a 'find' with an -exec of 'sed' would do >>>it but I'm not sure, and even if it were, I'm not sure of >>>the syntax. >>> >>>Could someone help me please? >>> >>>Thanks! >>>Jim >>> >>> >>> >>for i in `find /users/home -type f`; do >> sed -i '' >>"s|/cgi-bin/Count.cgi|http://counter.qcislands.net/cgi-bin/Count.cgi|g" $i >>done >> >> > >The only thing I would recommend different is to provide a backup file >extension to the -i option of sed. That way it keeps a copy of the file >as it was before sed touches it. This will save you a lot of headaches, >if sed does something you don't expect. > > > Yes, very good call. __________________________________________________ Frank Laszlo System Administrator The VonOstin Group Email: laszlof@tvog.net WWW: http://www.vonostingroup.com Mobile: 248-863-7584