我有一个简单的文件,我想用http://gems.ooyala.com
替换http://gems.sv2
。使用s
的{{1}}命令正常工作,直到我使用sed
。
任何提示?
-i
还有一些实验可以看到(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$
正在考虑的内容:
sed
我在Mac,El Capitan(Mac OS X 10.11.x)上。
(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$
我当然尝试了其他具有相同结果的分隔符:
(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$