分页: 1 / 1

find /etc/hosts 里的1.1.1.1并全部替换为2.2.2.2

发表于 : 2012-12-11 1:54
速腾1994
如题 :em03

Re: find /etc/hosts 里的1.1.1.1并全部替换为2.2.2.2

发表于 : 2012-12-11 3:01
速腾1994
sed -i "s#1.1.1.1#2.2.2.2#g" /etc/hosts

Re: find /etc/hosts 里的1.1.1.1并全部替换为2.2.2.2

发表于 : 2012-12-11 9:11
枫叶饭团
??。。 。

Re: find /etc/hosts 里的1.1.1.1并全部替换为2.2.2.2

发表于 : 2012-12-11 9:15
onlylove
自问自答?
去掉文件中的^M: sed -e "s/^M//g" filename > newfile
看这个帖子的时候坛子的小技巧……

Re: find /etc/hosts 里的1.1.1.1并全部替换为2.2.2.2

发表于 : 2012-12-11 10:16
速腾1994
我以为是find 后来看到用sed'
因为我的手机里的hosts有些不适用我们这,所以我用nslookup 得到google的ip想替换掉

Re: find /etc/hosts 里的1.1.1.1并全部替换为2.2.2.2

发表于 : 2012-12-11 10:26
onlylove
find不能替换吧,就是找到了也要调用其他程序替换

Re: find /etc/hosts 里的1.1.1.1并全部替换为2.2.2.2

发表于 : 2012-12-11 10:38
zhangxiaofir
都好早哈 :em01