如何将输出附加到文本文件的末尾 [英] How to append output to the end of a text file

查看:77
本文介绍了如何将输出附加到文本文件的末尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将命令的输出附加到文本文件的末尾?

How do I append the output of a command to the end of a text file?

推荐答案

将输出定向到文件时,使用>>代替>:

Use >> instead of > when directing output to a file:

your_command >> file_to_append_to

如果file_to_append_to不存在,则会创建它.

If file_to_append_to does not exist, it will be created.

示例:

$ echo "hello" > file
$ echo "world" >> file
$ cat file 
hello
world

这篇关于如何将输出附加到文本文件的末尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆