Not logged in. · Lost password · Register
Forum: General Help and Support Features and Functionality RSS
Replace a word on all DW pages
Birdy #1
Member for 2 weeks · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: Replace a word on all DW pages
What is the best way to change 1 specific word on all DW pages   for example: replace "ship"  by "Boat"
Avatar
MartinR #2
Member since Jul 2015 · 190 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Run a sed recipe or awk script over all the relevant pages.  Something like (and this is untested):

$ find pages -name \*.txt | while read fname
do
  mv $fname ${fname.old}
  awk '{ gsub(/ship/, "Boat"); print }' < ${fname.old} > $fname
done
You'll need to remove the .old files later once you are happy with the changes.
Avatar
Aleksandr #3
Member since Mar 2010 · 587 posts · Location: Volgograd, Russia
Group memberships: Members
Show profile · Link to this post
https://www.dokuwiki.org/plugin:batchedit
ru: Пожалуйста, избегайте избыточного цитирования.
en: Don’t use an overquoting, please.
Avatar
MartinR #4
Member since Jul 2015 · 190 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Neat!  (@Birdy, note the warning under Page lookup about index updates.)
Birdy #5
Member for 2 weeks · 2 posts
Group memberships: Members
Show profile · Link to this post
Thanks!
Avatar
molefunk #6
User title: molefunk
Member since Jul 2010 · 59 posts · Location: Mayapur, India
Group memberships: Members
Show profile · Link to this post
In reply to post #1
Another method is to run a regex search & replace in your local text editor. I'm using BBEdit to replace in thousands of pages without having to open and save each one. SublimeText is fast enough if there is only a few hundred. :)
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2020-04-02, 21:07:21 (UTC +02:00)