From owner-freebsd-questions@FreeBSD.ORG Fri Feb 18 17:40:07 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 3511A16A4CF for ; Fri, 18 Feb 2005 17:40:07 +0000 (GMT) Received: from ritamari.vonostingroup.com (ip193-230.digitalrealm.net [216.144.193.230]) by mx1.FreeBSD.org (Postfix) with ESMTP id 84EE143D55 for ; Fri, 18 Feb 2005 17:40:06 +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 1D2C7C-000Pma-M6; Fri, 18 Feb 2005 12:40:30 -0500 Message-ID: <42162874.6060304@tvog.net> Date: Fri, 18 Feb 2005 12:40:04 -0500 From: Frank Laszlo User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jim Pazarena References: <421622B0.9030600@ccstores.com> In-Reply-To: <421622B0.9030600@ccstores.com> Content-Type: text/plain; charset=ISO-8859-1; 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: 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 17:40:07 -0000 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 This should do the trick. Regards, Frank Laszlo