更新时间:2023-02-23 17:16:58
不是***的,但应该可以:
Not the greatest, but this should work:
sed -i 'Ns/.*/replacement-line/' file.txt
其中 N
应替换为您的目标行号.这将替换原始文件中的行.要将更改的文本保存在不同的文件中,请删除 -i
选项:
where N
should be replaced by your target line number. This replaces the line in the original file. To save the changed text in a different file, drop the -i
option:
sed 'Ns/.*/replacement-line/' file.txt > new_file.txt