Reputation: 1951
I am trying to replace a specific link which exists on many html pages with its https version. I have tried:
grep -rl "http://server.iad.liveperson.net/hc/88956865/" ./ | xargs sed -i "s/http:\/\/server.iad.liveperson.net\/hc\/88956865\//https:\/\/server.iad.liveperson.net\/hc\/88956865\//g"
When I do this, even as sudo
, I am getting
sed: couldn't open temporary file ./customers/sedTR3AMu: Permission denied
customers
is just the first directory in ./
. So, it is hanging on the first file I reckon, but not sure what is wrong beyond that.
Any help is appreciated!
Upvotes: 1
Views: 222
Reputation: 1951
Had to run the command logged in as root because sed -i creates temporary files in /tmp and needed write access.
Thanks:Used jim's syntax with the semicolons which worked fine. ooga, I did not have to escape the literal periods.
Upvotes: 1
Reputation: 5422
First thing you should try is to run the sed
command as stand alone, for a file that you previously know that contains that string. I have the feeling that the sed
command might be complaining about the /
characters...
You should try changing the sed
command to something like:
sed -i 's;http://server.iad.liveperson.net/hc/88956865/;https://server.iad.liveperson.net/hc/88956865/;g'
That is, using ;
instead of /
as the delimiter, so you don't have to escape the /
every time using \
.
Upvotes: 2