在特定行后使用 sed 添加语句 'hello, world'
使用 sed 命令可以在某一行之后加入一句话 'hello, world'。以下是示例命令:
sed '/某一行/a hello, world' 文件名
请将 '某一行' 替换为要在其后添加句子的行号或模式,将 '文件名' 替换为要操作的文件名。例如:
sed '/5/a hello, world' example.txt
这将在 example.txt 文件的第 5 行后添加句子 'hello, world'。
原文地址: https://www.cveoy.top/t/topic/qoNY 著作权归作者所有。请勿转载和采集!