gpt4 book ai didi

macos - 为什么我的 sed {r FILE d} 函数不起作用?

转载 作者:行者123 更新时间:2023-12-01 00:30:26 24 4
gpt4 key购买 nike

我不能说我理解错误消息。

bash_prompt% sed -e '/__SUBSTITUTE_HERE__/ {r tmp.txt d}' < myFile.txt 
sed: 2: "/__SUBSTITUTE_HERE__/ { ...": unexpected EOF (pending }'s)

我使用的是 OSX 10.7.4( Darwin 内核版本 11.4.0)

目标是在 bash 脚本中用另一个文件的内容替换一个文件中的 token 。

最佳答案

sed -e '/__SUBSTITUTE_HERE__/ {r tmp.txt' -e 'd;}' < myFile.txt

参见 http://www.linuxtopia.org/online_books/linux_tool_guides/the_sed_faq/sedfaq5_008.html

关于macos - 为什么我的 sed {r FILE d} 函数不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11799432/

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