Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Feb 2011 12:57:12 +0300
From:      Peter Andreev <andreev.peter@gmail.com>
To:        freebsd <freebsd-questions@freebsd.org>
Subject:   Re: script help
Message-ID:  <AANLkTi=3ngyVR38-tCjcMKxOpNNSN6Qo2uiJE7y4qpDD@mail.gmail.com>
In-Reply-To: <12e28896cd5.6574638108640039636.4001582758217268039@zoho.com>
References:  <3.0.1.32.20110214163437.019167e0@sage-american.com> <AANLkTinJn7=BMwCvRyEUoNQz-fR4%2BacHmiQovfuZ%2B69G@mail.gmail.com> <12e28896cd5.6574638108640039636.4001582758217268039@zoho.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <erikmccaskey64@zoho.com>:
> 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 &gt; 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 &lt;amvandemore@g=
mail.com&gt; =EDrta ----
>
> On Mon, Feb 14, 2011 at 4:34 PM, Jack L. Stone &lt;jacks@sage-american.co=
m&gt;wrote:
>
> &gt; Hello folks:
> &gt;
> &gt; No doubt this will be easy for those with scritping abilities.
> &gt;
> &gt; I have a gazillion files by the same name and each contains the same=
 line
> &gt; requiring the same change. But the problem is that they are in many
> &gt; different directories on a server with numerous domains. While I cou=
ld
> &gt; handle the change using a single directory within my abilities, I'm =
unsure
> &gt; how to do a search and replace throughout the many domains and their
> &gt; directories. Don't want to mess up. Here's what I'm trying to do:
> &gt;
> &gt; # find all of the same filenames (copyright.htm) and then replace th=
e year
> &gt; 2010 with 2011 in each file. Once I have a working script, I should =
be able
> &gt; to add it as a cron job to run on the first day of each new year.
> &gt;
> &gt; Any help appreciated.
> &gt;
>
> /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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTi=3ngyVR38-tCjcMKxOpNNSN6Qo2uiJE7y4qpDD>