replace url with sed
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
i want to replace 5000 image url from old server to new server
the following is an example of url for an image from the list
https://olddomain.tld/dir1/dir2/attachments/000/020/363/large/Garlic.jpg
now i want to replace from https to last forward slash in the url with "http://newdomain/images_folder/"
how could this be done using sed ?
any help will be appreciated
Thanks for all
linux sed
New contributor
add a comment |Â
up vote
0
down vote
favorite
i want to replace 5000 image url from old server to new server
the following is an example of url for an image from the list
https://olddomain.tld/dir1/dir2/attachments/000/020/363/large/Garlic.jpg
now i want to replace from https to last forward slash in the url with "http://newdomain/images_folder/"
how could this be done using sed ?
any help will be appreciated
Thanks for all
linux sed
New contributor
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
i want to replace 5000 image url from old server to new server
the following is an example of url for an image from the list
https://olddomain.tld/dir1/dir2/attachments/000/020/363/large/Garlic.jpg
now i want to replace from https to last forward slash in the url with "http://newdomain/images_folder/"
how could this be done using sed ?
any help will be appreciated
Thanks for all
linux sed
New contributor
i want to replace 5000 image url from old server to new server
the following is an example of url for an image from the list
https://olddomain.tld/dir1/dir2/attachments/000/020/363/large/Garlic.jpg
now i want to replace from https to last forward slash in the url with "http://newdomain/images_folder/"
how could this be done using sed ?
any help will be appreciated
Thanks for all
linux sed
linux sed
New contributor
New contributor
New contributor
asked 7 mins ago
nevermind ViRu
1
1
New contributor
New contributor
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
The solution is actually quite simple through the use of *
which, by default, is greedy in sed
(i.e. it matches the longest selection possible). Therefore you can match everything up to the last slash with ^.*/
Putting this into a full sed command:
sed 's|^.*/|new url/|'
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
The solution is actually quite simple through the use of *
which, by default, is greedy in sed
(i.e. it matches the longest selection possible). Therefore you can match everything up to the last slash with ^.*/
Putting this into a full sed command:
sed 's|^.*/|new url/|'
add a comment |Â
up vote
0
down vote
The solution is actually quite simple through the use of *
which, by default, is greedy in sed
(i.e. it matches the longest selection possible). Therefore you can match everything up to the last slash with ^.*/
Putting this into a full sed command:
sed 's|^.*/|new url/|'
add a comment |Â
up vote
0
down vote
up vote
0
down vote
The solution is actually quite simple through the use of *
which, by default, is greedy in sed
(i.e. it matches the longest selection possible). Therefore you can match everything up to the last slash with ^.*/
Putting this into a full sed command:
sed 's|^.*/|new url/|'
The solution is actually quite simple through the use of *
which, by default, is greedy in sed
(i.e. it matches the longest selection possible). Therefore you can match everything up to the last slash with ^.*/
Putting this into a full sed command:
sed 's|^.*/|new url/|'
answered 6 secs ago
apilat
112
112
add a comment |Â
add a comment |Â
nevermind ViRu is a new contributor. Be nice, and check out our Code of Conduct.
nevermind ViRu is a new contributor. Be nice, and check out our Code of Conduct.
nevermind ViRu is a new contributor. Be nice, and check out our Code of Conduct.
nevermind ViRu is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f479631%2freplace-url-with-sed%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password