我想知道在第一次使用GNU搜索字符串之后,是否有可能在文本文件的中间插入一些文本。
因此,例如,如果搜索字符串是"Hello",我想在新行的第一次出现"Hello“之后插入一个字符串。
Hello John, How are you?
....
....
....
Hello Mary, How are you doing? 字符串就在“你好约翰,你好吗?”之后输入。在一条新线路上
谢谢,
发布于 2014-02-03 17:15:01
使用sed:
sed '/Hello John, How are you?/s/$/\nsome string\n/' file
Hello John, How are you?
some string
....
....
....
Hello Mary, How are you doing? https://stackoverflow.com/questions/21533273
复制相似问题