zoukankan      html  css  js  c++  java
  • sed

    参考:

    • http://coolshell.cn/articles/9104.html
    • 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

    #获取IPv4
    ifconfig | grep 'inet[^6]' | sed '/^.*inets*127.*$/d' | sed 's/^.*inets*//g' | cut -d ' ' -f1

     PS

    • s后的第一个字符被视为分隔符,'s/...'(分隔符为:/)、's#...'(分隔符为:#)、's@...'(分隔符为:@) ...
    • 注意:当s后的第一个字符为#时,若正则表达式中出现了$且有用双引号("")来将替换描述括起来时,$#会使得shell将其解释为参数
  • 相关阅读:
    用Python证明“真理再前进一步就是谬误”
    senior developer in Hongkong
    Emacs 维基百科,自由的百科全书
    深入C(和C++)
    图灵等价和图灵完备
    2012年中国大陆和香港的工资收入水平市场调查报告
    图灵完备
    linux中vi进行字符替换_井底之蛙_百度空间
    they're hiring
    Linux下游戏大作赏析(三)
  • 原文地址:https://www.cnblogs.com/flowjacky/p/4343383.html
Copyright © 2011-2022 走看看