$ cat f1
My name is Bruce and my surname is我想使用SED查找“Bruce”,然后将“Lee”附加到找到“Bruce”的行尾
然后是一个更棘手的…。我想插入….a string…在一条线上我找到了一些东西。举个例子
$ cat f2
My name is Yacov and I am from Israel.
I used to be a programmer but then I found love for a woman who told me to become a teacher.我想使用SED在我找到字符串“programmer”的地方插入字符串“excellent”。我想在子字符串“programmer”的开头插入这个字符串
发布于 2016-08-06 22:04:01
你已经试过了吗?
$ cat f1
My name is Bruce and my surname is
$ sed 's/^.*Bruce.*$/& Lee/' f1
My name is Bruce and my surname is Lee
$ cat f2
My name is Yacov and I am from Israel.
I used to be a programmer but then I found love for a woman who told me
to become a teacher.
$ sed 's/programmer/excellent programmer/' f2
My name is Yacov and I am from Israel.
I used to be a excellent programmer but then I found love for a woman
who told me to become a teacher.https://stackoverflow.com/questions/37841194
复制相似问题