From owner-freebsd-questions@FreeBSD.ORG Tue Feb 15 10:22:53 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBBAA10656A4 for ; Tue, 15 Feb 2011 10:22:52 +0000 (UTC) (envelope-from andreev.peter@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id 9739D8FC14 for ; Tue, 15 Feb 2011 10:22:52 +0000 (UTC) Received: by ywl2 with SMTP id 2so1457ywl.13 for ; Tue, 15 Feb 2011 02:22:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=RLd0Lkoq1+Ju6lQPEyDCqzAQip/SndiqcuvNrpkJDtA=; b=vGI6C2PZxHstJXIzOK1xWz+jBh4+XMoHma66D7nTiuS8ktbAqZQh66ZR3G1TuUr10f dtR/+xGw7j5FHikHOK3rcxht4cKqo/tHQBTWqps/m/yxemUYKcAeFdgPPzj6vKtXQ2+C vT5c7jcK9DQ2G8tdxDDBIaG8fXEmb3qX2BwFg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=H0HfmLWv3fM2+F0u7DocZC4+aY96Ib2NZPSKTR9XQkEuWxNw85shnZyWDf7cAbvegX mOp5UNZVBEwwdp8kZB+9BiSSSQXvdk0CpTLeu2iuUXtskzaI+SoGczcPAGUkNEdZMCoB E2y7TShGtH6+oOiQSLrqVzaw90LI3CmtE+CBY= MIME-Version: 1.0 Received: by 10.91.199.4 with SMTP id b4mr3450070agq.157.1297763832583; Tue, 15 Feb 2011 01:57:12 -0800 (PST) Received: by 10.90.141.16 with HTTP; Tue, 15 Feb 2011 01:57:12 -0800 (PST) In-Reply-To: <12e28896cd5.6574638108640039636.4001582758217268039@zoho.com> References: <3.0.1.32.20110214163437.019167e0@sage-american.com> <12e28896cd5.6574638108640039636.4001582758217268039@zoho.com> Date: Tue, 15 Feb 2011 12:57:12 +0300 Message-ID: From: Peter Andreev To: freebsd Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: script help 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: Tue, 15 Feb 2011 10:22:53 -0000 Use of "xargs" on many files will be much faster than "find...exec" constru= ction find / -type f -name copyright.htm | xargs sed -i .bak -e 's/2010/2011/g' 2011/2/15 erikmccaskey64 : > my little opinion: first run the changes on a backup, or a copy of the fi= les: > > this one works under linux bash fedora: > how to create a "shadow" of a folder [same filenames in another dir, but = with 0 Byte size] > > > in the original, "A" directory: > find . -type f > a.txt > > > "B" directory: > cat ../a.txt | while read file; do if [[ "$file" =3D */* ]]; then mkdir -= p "${file%/*}"; fi; touch "$file"; done > > > > > so if something goes wrong, there would be no trouble > > ---- Be Mon, 14 Feb 2011 15:11:19 -0800 Adam Vande More <amvandemore@g= mail.com> =EDrta ---- > > On Mon, Feb 14, 2011 at 4:34 PM, Jack L. Stone <jacks@sage-american.co= m>wrote: > > > Hello folks: > > > > No doubt this will be easy for those with scritping abilities. > > > > I have a gazillion files by the same name and each contains the same= line > > requiring the same change. But the problem is that they are in many > > different directories on a server with numerous domains. While I cou= ld > > handle the change using a single directory within my abilities, I'm = unsure > > how to do a search and replace throughout the many domains and their > > directories. Don't want to mess up. Here's what I'm trying to do: > > > > # find all of the same filenames (copyright.htm) and then replace th= e year > > 2010 with 2011 in each file. Once I have a working script, I should = be able > > to add it as a cron job to run on the first day of each new year. > > > > Any help appreciated. > > > > /usr/ports/misc/rpl > > -- > Adam Vande More > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.o= rg" > > > > > > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.o= rg" > --=20 -- AP