Grep for String and open at the corresponding line

前端 未结 3 1293
死守一世寂寞
死守一世寂寞 2021-01-21 05:58

I\'m having several occurrences of a specific string over several files in several lines obtained with grep.

$ grep -rn --include=\"*.cpp\" mystring         


        
3条回答
  •  花落未央
    2021-01-21 06:34

    A trick to use vim as a pager is to pass it a hyphen character. This causes it to read from STDIN instead of from file

    grep -rn --include="*.cpp" mystring | vim -
    

提交回复
热议问题