【发布时间】:2012-04-22 13:02:24
【问题描述】:
我有 text1.txt 包含
<this can be anything, any number of line - no hardcoded>
<this can be anything, any number of line - no hardcoded>
param1=<this can be any value - no hardcoded>
<this can be anything, any number of line - no hardcoded>
<this can be anything, any number of line - no hardcoded>
我想用 abc
替换这部分 这可以是任何值 - 没有硬编码正确的 SED 命令应该是什么? 请注意,由于环境限制,我无法灵活使用任何语言,例如 perl、python 或 ruby ~ 并且只能使用 Unix 命令。 并且除了 param1
之外没有硬编码提前非常感谢!
【问题讨论】:
-
This SO question 可能会有所帮助。
-
评论中的所有样本值怎么样?
-
@shiplu 你能否澄清一下评论的构成,根据 OP 的问题,
text1.txt是一个普通的文本文件,所以任何东西都可以表明评论? -
我向 OP 提出了这个问题以进行澄清