Bulk search/replace text within Confluence pages under specified parent page.

Hello,

We would like to search and replace texts within Confluence pages under specified parent page.

Let's say we've got following page structure,

Parent page

--Child page 1 (contains text "a")

--Child page 2 (contains text "a")

--Child page 3 (contains text "a")

We would like to replace text "a" within child page 1 to child page 3 with text "b" at once.

Is there any remote API available to achieve this, or do we need to create plugin for this purpose? Please advise.

Regards,

Daisuke Niwa

1 answer

1 accepted

I can think about using the Confluence CLI and a bit of scripting to do it. Download the content as wiki, do search and replace and upload it back.

Thank you for your response. I went through the documentation of Confluence CLI but could not find a method to replace certain character.

https://bobswift.atlassian.net/wiki/display/CSOAP/Documentation

Is it possible for you to let me know which method I should use?

Regards,

Daisuke Niwa

Actually, "storePage" methold supports "findReplace" parameter which finds and replaces text within Confluence page.

Thanks, that helps!

Ah no, I meant to write a script which uses CLI. Do this in the script: 1. Use CLI with getPage option first, it will write a file 2. Do the replace operation in a file, there are famous perl one liners for that or use sed 3. Use CLI with storePage option and upload back to Confluence.
Ah great. That makes it easy.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

869 views 23 12
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