首页 > 其他 > 详细

sed

时间:2015-03-17 00:38:17      阅读:316      评论:0      收藏:0      [点我收藏+]

参考:

  • http://blog.chinaunix.net/uid-25120309-id-3349691.html
  • http://blog.sina.com.cn/s/blog_88cdde9f010199ps.html
ifconfig eth0 | grep "inet[^6]" | sed -n ‘s#^.*:\([0-9].*\) *B.*$#\1#gp‘ | sed ‘s#\s*$##g‘
ifconfig eth0 | grep "inet[^6]" | sed -n ‘s#^.*:\([0-9].*\) *B.*$#\1#gp‘ | wc
ifconfig eth0 | grep "inet[^6]" | sed -n ‘s#^.*:\([0-9].*\) *B.*$#\1#gp‘ | sed ‘s#\s*$##g‘ | wc
#将web.xml中的"http://IP:8080"中的IP置换为自己定义的
xyz="192.168.0.108"cat web.xml | sed -n "s/http:\/\/\([[:digit:]]\{1,3\}.*\):8080/http:\/\/$xyz:8080/p”sed -i "s/http:\/\/[[:digit:]]\{1,3\}.*:8080/http:\/\/$xyz:8080/g" web2.xml
#将settings.py中的"http://IP"中的IP置换为自己定义的
xyz="192.168.0.108"
cat settings.py | sed -n "/\([[:digit:]]\.\)/p” cat settings.py | sed -n "/\([[:digit:]]\{1,3\}\.\)\{3\}[[:digit:]]\{1,3\}/p" | nl cat settings.py | sed -n "/http:\/\/\([[:digit:]]\{1,3\}\.\)\{3\}[[:digit:]]\{1,3\}/p" | nl sed -i "s/http:\/\/\([[:digit:]]\{1,3\}\.\)\{3\}[[:digit:]]\{1,3\}/http:\/\/$xyz/g" settings2.py

 

sed

原文:http://www.cnblogs.com/flowjacky/p/4343383.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!