Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 XML,我想在多行上搜索和匹配字符串:
</head> <head>
这个想法是最终插入
</head> </body> <body> <head>
我认为这对 vi 是可行的,我进行了一些研究并找到了“_s”,但它似乎不适用于多行。这就是我尝试过的:
/<\/head>\_s<head>
有人可以帮忙吗?
您提供的模式按预期工作:
<head> </head> <head> </head> <head> </head> :%s/<\/head>\_s<head>/<\/head>\r<body>\r<\/body>\r<head>/gc # remove c <head> </head> <body> </body> <head> </head> <body> </body> <head> </head>