美文网首页
Shell:sed用法 - 查找并替换字符串

Shell:sed用法 - 查找并替换字符串

作者: HarveyCC | 来源:发表于2018-12-23 18:36 被阅读16次

    原文链接

    语法

    sed 's/serach_str/replace_str/g' file_path
    

    在某个文件中查找所有的serach_str并替换为replace_str

    参数 描述
    serach_str 要搜索的字符串
    replace_str 用于替换搜索到的字符串
    file_path 文件路径

    用法举例

    sed 's/to/too/g' my.txt
    

    my.txt文件中查找所有的to并用too替换掉

    相关文章

      网友评论

          本文标题:Shell:sed用法 - 查找并替换字符串

          本文链接:https://www.haomeiwen.com/subject/psgnkqtx.html