zoukankan      html  css  js  c++  java
  • 50个常用的Linux命令(二)sed

    [root@localhost cee]# echo this thisthisthis |sed 's/this/THIS/g'
    THIS THISTHISTHIS
    [root@localhost cee]# echo this thisthisthis |sed 's/this/THIS/2g'
    this THISTHISTHIS
    [root@localhost cee]# echo this thisthisthis |sed 's/this/THIS/3g'
    this thisTHISTHIS
    [root@localhost cee]# echo this thisthisthis |sed 's/this/THIS/4g'
    this thisthisTHIS


    [root@localhost cee]# cat temp
    i love linux

    i love python
    william
    [root@localhost cee]# sed '/^$/d' temp
    i love linux
    i love python
    william
    [root@localhost cee]# cat temp
    i love linux

    i love python
    william

    [root@localhost cee]# echo this is an example |sed 's/w+/[&]/g'
    [this] [is] [an] [example]
    [root@localhost cee]# echo this is an example |sed 's/w+/"&"/g'
    "this" "is" "an" "example"
    [root@localhost cee]# echo this is digit 7 in a number | sed 's/digit ([0-9])/1/g'
    this is 7 in a number

    [root@localhost cee]# echo seven EIGHT |sed 's/([a-z]+) ([A-Z]+)/2 1/g'
    EIGHT seven

    sed 'exp'|sed 'exp2' == sed 'exp;exp2'

    [root@localhost cee]# text=hello
    [root@localhost cee]# echo hello world | sed "s/$text/HELLO/g"
    HELLO world

  • 相关阅读:
    跟layout_weight说88,轻松搞定百分比布局
    跟闪退、程序崩溃说88
    程序的需求层次
    开博
    第十章 数组与集合 发牌程序 实例代码
    C#面向对象基础01
    winform form
    html
    C#语言基础02
    C#语言基础01
  • 原文地址:https://www.cnblogs.com/william126/p/10396265.html
Copyright © 2011-2022 走看看