【问题标题】:Replace content from file using sed command使用 sed 命令替换文件中的内容
【发布时间】:2015-06-30 09:44:12
【问题描述】:

您好,我想使用 sed 命令替换文件中的以下行。

) ENGINE=TokuDB DEFAULT CHARSET=utf8 compression='tokudb_zlib';

我想替换以 ) ENGINE 开头的行并将完整的行替换为 ;

【问题讨论】:

  • 你有没有尝试过?

标签: linux bash shell


【解决方案1】:

使用以下命令完成

sed "s/) ENGINE.*/);/g" abc.sql > abc1.sql

【讨论】:

    【解决方案2】:

    尝试:

    sed -i 's/)\sENGINE.*/;/g' path_to_your_file
    

    【讨论】:

      猜你喜欢
      • 2017-08-23
      • 2013-09-25
      • 1970-01-01
      • 2021-12-15
      • 2017-12-17
      • 2022-01-10
      • 2014-12-28
      • 2016-07-25
      • 2022-01-05
      相关资源
      最近更新 更多