您可以批量编辑 grep 中返回的所有文件吗? [英] Can you mass edit all files returned in a grep?
本文介绍了您可以批量编辑 grep 中返回的所有文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想批量编辑大量在 grep 中返回的文件.(我知道,我应该更擅长 sed).
I want to mass-edit a ton of files that are returned in a grep. (I know, I should get better at sed).
如果我这样做:
grep -rnI 'xg_icon-*'
如何将所有这些文件通过管道传输到 vi 中?
How do I pipe all of those files into vi?
推荐答案
最简单的方法是让 grep 只返回文件名(-l
而不是 -n
)匹配模式.在子 shell 中运行它并将结果提供给 Vim.
The easiest way is to have grep return just the filenames (-l
instead of -n
) that match the pattern. Run that in a subshell and feed the results to Vim.
vim $(grep -rIl 'xg_icon-*' *)
这篇关于您可以批量编辑 grep 中返回的所有文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文