[[email protected] directoryName]$ grep -RlI "send you instr" *
application/views/scripts/auth/forgot.phtml
[[email protected] directoryName]$
是否有引用唯一结果的快速入侵?我可以以某种方式管它到vim吗?如何在grep中唯一的结果自动打开文件?
[[email protected] directoryName]$ grep -RlI "send you instr" *
application/views/scripts/auth/forgot.phtml
[[email protected] directoryName]$
是否有引用唯一结果的快速入侵?我可以以某种方式管它到vim吗?如何在grep中唯一的结果自动打开文件?
打开vim的一个新的文件并插入找到的文件名作为文本:
grep -RlI "send you instr" * | vim -
打开找到的文件直接在vim:
grep -RlI "send you instr" * | xargs vim
如果你用它打开一切OK结果在Vim中,你可以这样做:
vim $(grep -RlI "send you instr" *)
你会被放入一个缓冲区,第一个匹配的文件,并可以naviga用:next
与其他人联系。
vim `grep -RlI "send you instr" *`
难道是我还是这个命令有点迟缓? – 2010-10-12 21:18:14
在这种情况下,grep会在vim运行之前搜索所有文件。如果你只对第一个结果感兴趣,你可以尝试'vim $(grep -RlI“发送你instr”* |头-1)'来提高速度。在读完第一行后,'head'命令关闭管道,发出grep信号提前结束。 – Jander 2010-10-14 04:19:38