我不确定你想要什么内容,但是我会提供一个示例,将第一行的文本替换为“Hello World!”:

假设有一个名为example.txt的文件,其内容如下:

This is the first line.
This is the second line.
This is the third line.

要将第一行替换为“Hello World!”,可以使用以下sed命令:

sed '1s/.*/Hello World!/' example.txt

运行此命令后,输出将如下所示:

Hello World!
This is the second line.
This is the third line.

这个命令中的“1”表示要在第一行进行替换,“s”表示要进行替换操作,“.*”表示将整行替换为“Hello World!”

sed 第一行抛入

原文地址: https://www.cveoy.top/t/topic/b1oK 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录