Find and Replace?

Emily Johnson July 5, 2011

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

1 vote
Thomas Krug July 5, 2011

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.

Emily Johnson July 6, 2011

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

Jeremy Largman
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 10, 2011

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.

0 votes
Jim Birch
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 6, 2011

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
TAGS
AUG Leaders

Atlassian Community Events