当前位置: 技术问答>linux和unix
使用sed插入一行到一个空文件中
来源: 互联网 发布时间:2017-05-13
本文导语: 使用touch创建一个空文件,如何使用sed向这个文件中插入新行呢,我发现只要文件是空的,sed好像不管用了啊。 请大家指导指导,谢谢! | Sed is a stream editor. A stream editor is used ...
使用touch创建一个空文件,如何使用sed向这个文件中插入新行呢,我发现只要文件是空的,sed好像不管用了啊。
请大家指导指导,谢谢!
请大家指导指导,谢谢!
|
Sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a
pipeline). While in some ways similar to an editor which permits scripted edits (such as ed), sed works by making only one pass over
the input(s), and is consequently more efficient. But it is sed’s ability to filter text in a pipeline which particularly distin-
guishes it from other types of editors.
它需要有输入
pipeline). While in some ways similar to an editor which permits scripted edits (such as ed), sed works by making only one pass over
the input(s), and is consequently more efficient. But it is sed’s ability to filter text in a pipeline which particularly distin-
guishes it from other types of editors.
它需要有输入
|
可以考虑不用touch,改成别的命令:
echo "" >a.txt