【问题标题】:Copy content of a file to multiple files using CAT command in UNIX在 UNIX 中使用 CAT 命令将文件的内容复制到多个文件
【发布时间】:2017-09-08 15:56:50
【问题描述】:

我有 3 个文件 文件 1、文件 2、文件 3 我想在一个命令中将 File1 的内容复制到 File2 和 File3 是否可以使用 CAT 命令 如果是,如何,如果不是,那么使用哪个命令来执行此任务

【问题讨论】:

    标签: unix


    【解决方案1】:

    也许这段代码可以帮助你。

    cat file1.txt >> file2.txt && cat file1.txt >> file3.txt
    

    【讨论】:

      【解决方案2】:

      使用tee:

      $ cat file1 | tee file2 > file3
      

      man tee:

      NAME
             tee - read from standard input and write to standard output and files
      

      【讨论】:

        猜你喜欢
        • 2020-12-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-05-19
        • 1970-01-01
        • 2013-10-08
        • 2013-07-18
        相关资源
        最近更新 更多