[pmwiki-users] Change the content of many pages at a time
Peter Bowers
pbowers at pobox.com
Tue Dec 9 00:49:43 CST 2008
Wikish handles bulk replaces using the "sed" command. It supports regular
expressions, but if your "find text" is "date_of_birht" that is a very
legitimate regex -- regexes start simply and only get complicated when you
add periods, brackets, asterisks, etc.
You can see examples at Cookbook/WikiShExamples
http://www.pmwiki.org/wiki/Cookbook/WikiShExamples
Note that the challenge of doing it within php is the execution timeout.
WikiSh has ways to work with this timeout, but they are a little awkward.
If you can increase that timeout while you are doing the search/replace that
is your easiest solution.
-Peter
> -----Original Message-----
> From: pmwiki-users-bounces at pmichaud.com [mailto:pmwiki-users-
> bounces at pmichaud.com] On Behalf Of kirpi at kirpi.it
> Sent: Friday, December 05, 2008 4:42 PM
> To: PmWiki-Users List
> Subject: [pmwiki-users] Change the content of many pages at a time
>
> Pmwiki is so nice that we use it extensively, really.
> Now, one may need to make bulk changes to the content of all/many
> pages at a time. This is particularly true now that, thanks to PTVs,
> we can use pmwiki pages to record fields like "Date_of_birth:
> 2009/10/09".
>
> Imagine you have 300 pages in a Friends group, one per friend, and
> each page contains:
>
> * Name: xxx
> * Surname: xxx
> * Date_of_birht: xxx
> * Email: xxx
>
> What if I want to correct "Date_of_birht" to "Date_of_birth" to all
> the 300 pages?
> And, what if I want to add a "Sex:" variable just below "Surname:"?
>
> I've been told that there are unix tools like awk[1] which can make
> the trick but, as far as my experience goes and despite nice pages
> like "Become an expert in 60 minutes", it turns out that it may takes
> ages before you can use awk: you have to *first* study Regular
> Expressions[2] (which are a very complicated beast and may take weeks
> to master), and later approach awk itself.
>
> I personally found Emacs to be a friendlier choice, although not
> necessarily easy to use[3].
> I just started Cookbook/BulkReplace[4], but I'm surely not able to
> write about technical subjects.
>
> My questions are:
> a) Does anybody want/is_able to contribute his/her knowledge to the
> Cookbook/BulkReplace page, in order to provide pmwiki users with
> useful/practical advices on the matter?
> b) Does anybody know of a way to use php for such a purpose, so that a
> general script could be made into a recipe?
>
>
> Luigi
>
>
> ----
> [1] http://en.wikipedia.org/wiki/AWK
> [2] http://www.pmwiki.org/wiki/Cookbook/RegularExpressions thanks to
> Joachim Durchholz
> [3] I do not know how to write "line break"
> [4] http://www.pmwiki.org/wiki/Cookbook/BulkReplace
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
More information about the pmwiki-users
mailing list