31. 组合 a、i 和 c 命令
最后更新时间 (CST):2023-07-21 06:45:01 +0800
您还可以组合使用 a、i 和 c 命令。 以下 sed 示例执行所有这三件事:
a
—— 在 "Jason"
后添加 "Jack Johnson"
i
—— 在 "Jason"
之前插入 "Mark Smith"
c
—— 将 "Jason"
更改为 "Joe Mason"
$ sed '/Jason/ {
a\
204,Jack Johnson,Engineer
i\
202,Mark Smith,Sales Engineer
c\
203,Joe Mason,Sysadmi
}' employee.txt
101,John Doe,CEO
202,Mark Smith,Sales Engineer
203,Joe Mason,Sysadmin
204,Jack Johnson,Engineer
103,Raj Reddy,Sysadmin
104,Anand Ram,Developer
105,Jane Miller,Sales Manager
如未另行说明,那么本页面中的内容已根据 知识共享署名 4.0 许可 获得了许可,并且代码示例已根据 Apache 2.0 许可 获得了许可。内容随着时间推移,可能会过期,会定时更新或移除一些旧的内容。
最后更新时间 (CST):2023-07-21
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"很难理解"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"信息或示例代码不正确"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"没有我需要的信息/示例"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]