Find Replace using CLI

Hi,

Iam trying to replace the URL in Space using CLI .

Approach 1:

./confluence.sh --action storePage --space "zconfluencecliTarget" --title "This is title 1" --findReplace "'http://testpage:8080':'http://confluence:8080'"

In this case i could not see any change in the page

Approach 2:

./confluence.sh --action modifyPage --id 105219716 --findReplace "'http://testpage:8080':'http://confluence:8080'"

Here the URL gets replaced to //testpage://testpage:8080

Could any one please help in undestanding what is going on wrong in here .

Also is there a way to search replace a URL in entire Space using CLI rather than doing it for title.

Thanks in advance,

Aravind

2 answers

0 votes
Timothy Chin Community Champion May 20, 2013

Thy this?

--action modifyPage --id 12345678 --findReplace "xxx:yyy"

Thanks for the replay m

I tried ./confluence.sh --action modifyPage --id 105219716 --findReplace "'http://testpage:8080':'http://confluence:8080',"

In this case the"http://testpage:8080" gets replaced to " //testpage://testpage:8080"

Please try using: "'http://testpage:8080':'http://confluence:8080',"

It is an quoting oddity that I would like to fix.

Thanks for the reply ,

Below is my confluence content :

Test page

Test page

Test page

http://testpage:8080

Test page

Command:./confluence.sh --action storePage --space "zconfluencecliTarget" --title "This is title 1" --findReplace "'http://testpage:8080':'http://confluence:8080',"
Page updated: 'This is title 1'. Page has id: 103229632

After firing the commands also contents remains same.

Also is there a way to update the entire Space or all the occurences in the application using CLI ?

Sorry, I should have tested it first. Even I get confused by the workaround :(. Use the following - I have put in some extra spaces so it is readable here. The inner single quotes had to be doubled:

--findReplace " ' ''http://confluence:8080'':''http://testpage:8080'' ' "

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 24, 2018 in Confluence

Atlassian Research opportunity with Confluence templates

Do you use templates with Confluence? Take part in a remote 1-hr workshop. You'll receive USD $100 for your time!   We're looking for people to participate in a   remote 1-hr workshop...

1,031 views 15 13
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