【问题标题】:How to create a text file with specific text in it in Linux?如何在 Linux 中创建包含特定文本的文本文件?
【发布时间】:2023-03-30 16:14:02
【问题描述】:

我想用 1 行代码做到这一点:

创建一个文本文件,在其中放置 3 个句子。我知道创建空文本文件的命令是“cat > sample.txt”,但我想在一行代码中创建包含这 3 个句子的文件。 像这样:

sentence1
sentence2
sentence3

【问题讨论】:

    标签: linux ubuntu cat


    【解决方案1】:
    echo -e "sentence1 \nsentence2 \nsentence3" >> sample.txt
    

    【讨论】:

    猜你喜欢
    • 2013-06-02
    • 2017-07-03
    • 1970-01-01
    • 2023-03-26
    • 2011-11-04
    • 1970-01-01
    • 1970-01-01
    • 2018-01-14
    相关资源
    最近更新 更多