交互搜索并从shell中进行替换 [英] Interactive search and replace from shell

查看:168
本文介绍了交互搜索并从shell中进行替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的编辑器中搜索和替换多个文件是困难的。有很多技巧可以用 find xargs sed / awk 包括搜索和替换在多个文件中。但不知何故,我找不到一种方法来进行这种互动。你知道一个办法吗?

解决方案

KISS原则:

< pre $ vim
:args`ls`
:argdo%s#SEARCH#REPLACE#gec | update

首字符afer%s用作分隔符

Search and replace over multiple files is difficult in my editor. There are plenty of tricks that can be done with find, xargs and sed/awk incluing search-and replace in multiple files. But somehow I couldn't find a way to make this interactive. Do you know a way to do that?

解决方案

KISS principle:

vim
:args `ls`
:argdo %s#SEARCH#REPLACE#gec |update

First character afer %s is used as separator

这篇关于交互搜索并从shell中进行替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆