Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Find Replace using CLI

aravind May 20, 2013

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
Bob Swift
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.
May 21, 2013

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

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

aravind May 21, 2013

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 ?

Bob Swift
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.
May 21, 2013

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'' ' "

0 votes
Timothy
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.
May 20, 2013

Thy this?

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

aravind May 21, 2013

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"

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events