如何将文本追加到文件? [英] How do I append text to a file?

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

问题描述

什么是追加文本在Linux文件最简单的方法?



我有一个看的在这个问题,但接受的答案使用一个附加的程序( SED )我肯定有应与回波更简单的方法或类似的。

解决方案

  cat>>文件名
这是文本,也许从其他来源粘贴。
或者在键盘上输入,没关系。
$ D

实际上,您可以将所需文本转储到文件中。 CTRL-D发送一个文件结束信号,它终止输入并返回到shell。

What is the easiest way to append text to a file in Linux?

I had a look at this question, but the accepted answer uses an additional program (sed) I'm sure there should be an easier way with echo or similar.

解决方案

cat >> filename
This is text, perhaps pasted in from some other source.
Or else entered at the keyboard, doesn't matter. 
^D

Essentially, you can dump any text you want into the file. CTRL-D sends an end-of-file signal, which terminates input and returns you to the shell.

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

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