script help
Peter Andreev
andreev.peter at gmail.com
Tue Feb 15 10:22:53 UTC 2011
Use of "xargs" on many files will be much faster than "find...exec" construction
find / -type f -name copyright.htm | xargs sed -i .bak -e 's/2010/2011/g'
2011/2/15 erikmccaskey64 <erikmccaskey64 at zoho.com>:
> my little opinion: first run the changes on a backup, or a copy of the files:
>
> 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" = */* ]]; 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 at gmail.com> írta ----
>
> On Mon, Feb 14, 2011 at 4:34 PM, Jack L. Stone <jacks at sage-american.com>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 could
> > 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 the 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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>
>
>
>
>
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>
--
--
AP
More information about the freebsd-questions
mailing list