Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Description

This describes how to add some standard text to the beginning or end of a bunch of Confluence pages. This assumes you have access to the Confluence database for running a read-only query to select the pages that you are interested in updating.

Tip
titleTest carefully

Test on a few pages first to make sure the result is what you want!

Steps

  1. Construct a SQL query that selects the pages you are interested in. Test against your database.

    Code Block
    sql
    sql
    select '--id ' || contentid from content where content.title like '%title 1%' and contenttype = 'PAGE' and content.spaceid = (select spaceid from spaces where spacekey = 'zconfluencecli2')
    


  2. Figure out the runFromSql parameters for accessing your database.
  3. Put it all together in a single command: 

    No Format
    confluence -a runFromSql --common "-a modifyPage --content \"before existing content\" " --database confluence-3.5.13 --driver postgresql --sql "select '--id ' || contentid from content where content.title like '%title 1%' and contenttype = 'PAGE' and content.spaceid = (select spaceid from spaces where spacekey = 'zconfluencecli2')"
    


Tip
titleUse find and replace support to modify existing content

--findReplace and/or --findReplaceRegex can be used to modify the contents with or without adding additional content. Watch out for unintended substitutions - choose your find string/regex carefully.

No Format
titleExample
--action modifyPage --id 12345678 --findReplace "xxx:yyy"



Tip
titleAlternatives

runFromPageList and runFromList or similar can also be used to accomplish similar things without SQL