-6ren">
gpt4 book ai didi

linux - 在文件中添加文本

转载 作者:IT王子 更新时间:2023-10-29 00:53:40 25 4
gpt4 key购买 nike

我已经使用 awk 命令在文件中查找特定行,并想将其添加到第二个文件中。有人可以在这方面帮助我吗?

最佳答案

简短的回答是你不能。您需要一个临时文件。

echo "Prepended Line" > tmpfile && cat origfile >> tmpfile && mv tmpfile origfile

编辑:

sed -i 's/\(line you want\)/Prefix \1/g' origfile

关于linux - 在文件中添加文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5150835/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com