Find and Replace?

Hi,

We are changing the name of one of our products, and I need to do a find and replace in our knowledge base. (Doing this by hand would be kind of ridiculous.) I'm not finding any options---does anyone else know how to do it? This plugin (https://studio.plugins.atlassian.com/wiki/display/CGSR/Confluence+Global+Search+and+Replace+Plugin) is not updated to Confuence 3.5.

Thanks!

Emily

2 answers

I am doing search and replace with the the Confluence Command Line Interface

https://studio.plugins.atlassian.com/wiki/display/CSOAP/Confluence+Command+Line+Interface

using the 'getPageList', 'getPageSource' and 'storePage' actions.

Utilizing this within a shell script you can export the pages to plain text files, perform the search and replace using tools like UltraEdit and push them back to confluence again.

Thank you Thomas, but I don't think I have access to the command line because we've got a hosted instance. :( Maybe I can get support to do this though

Hi Emily,

The Remote API is open on hosted instances (or it should be, if you request it!). You also have admin access and can enable the remote API. You should be able to run a find and replace script that way, with full programmatic logic to make sure you don't make any mistakes. That is, you can output everything in a report for manual inspection first then run the replacement.

You can find the pages by running with the sql script against the database (if that's your kind of thing.) Even if you edit in Confluence this will give you the scope.

It's also possible to edit via sql but not recommended, you must take a backup(!), stop Confluence, run update, then reindex on restart. In addition to the command line interface, the webDAV interfce could also be used (if it still works.)

-- Query to locate current pages containing a specified string
-- Jim Birch 2011.01.28
select  -- top 100
 s.spacekey, c.TITLE, c.CREATOR, c.LASTMODIFIER, c.LASTMODDATE --, bc.body 
from
  dbo.CONTENT c
join
  dbo.BODYCONTENT bc
on
 c.CONTENTID = bc.CONTENTID
-- note: spaceid is null on old page versions so join on
-- space id selects only current pages.  Nice.
join
 dbo.SPACES s
on
 s.SPACEID = c.SPACEID
where
 bc.BODY like '%productname%' 
order by
 s.spacekey, c.title

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

357 views 20 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you