I have a simple file where I want to replace http://gems.ooyala.com
with http://gems.sv2
. My s
command with sed
works fine until I use -i
.
Any hints?
(0)kashyap@vpn-client-223$ cat Gemfile
source "https://rubygems.org"
source "http://gems.ooyala.com"
gem "json-processing-profile"
gem "panache", ">= 0.1.3"
gem "pathological"
gem "sassy_gurl"
(0)kashyap@vpn-client-223$
(0)kashyap@vpn-client-223$
(0)kashyap@vpn-client-223$ sed 's~source "http://gems.ooyala.com"~source "http://gems.sv2"~g' Gemfile
source "https://rubygems.org"
source "http://gems.sv2" <--- updated as expected..
gem "json-processing-profile"
gem "panache", ">= 0.1.3"
gem "pathological"
gem "sassy_gurl"
(0)kashyap@vpn-client-223$
(0)kashyap@vpn-client-223$
(0)kashyap@vpn-client-223$ sed -i 's~source "http://gems.ooyala.com"~source "http://gems.sv2"~g' Gemfile
sed: 1: "Gemfile": extra characters at the end of G command
(1)kashyap@vpn-client-223$
(0)kashyap@vpn-client-223$
Some more experiments to see what sed
is thinking if it helps:
(0)kashyap@vpn-client-223$ cd ..
(0)kashyap@vpn-client-223$ sed -i 's~source "http://gems.ooyala.com"~source "http://gems.sv2"~g' my_test/Gemfile
sed: 1: "my_test/Gemfile": invalid command code o
(1)kashyap@vpn-client-223$ cd -
/Users/kashyap/repos/ots-system-test
(0)kashyap@vpn-client-223$ sed -i 's~source "http://gems.ooyala.com"~source "http://gems.sv2"~g' ../my_test/Gemfile
sed: 1: "../my_test/Gemfile": invalid command code .
(1)kashyap@vpn-client-223$
I'm on Mac, El Capitan (Mac OS X 10.11.x).
(0)kashyap@vpn-client-223$ which sed
/usr/bin/sed
(0)kashyap@vpn-client-223$ file /usr/bin/sed
/usr/bin/sed: Mach-O 64-bit executable x86_64
(0)kashyap@vpn-client-223$
I of course tried other separators with same result:
sed -i 's/source "http:\/\/gems.ooyala.com"/source "http:\/\/gems.sv2"/g' Gemfile
sed -i 's#source "http://gems.ooyala.com"#source "http://gems.sv2"#g' Gemfile