How to recursively grep the pattern inside the directory?
Asked Answered
D

2

5

I would like to grep all string patterns which are start with the: student_ , then any numbers of symbols(letters and digits) and end with the .tcl

Destinee answered 11/4, 2013 at 12:43 Comment(0)
T
4
grep "student_[[:alnum:]]*\.tcl" *
Timeless answered 11/4, 2013 at 12:58 Comment(0)
C
19

If you're using vim 7, it comes with a build in grep function that puts the result in a quicklist-window.

try

:vimgrep /^student_/ **/*.tcl

** makes the search recursivelly

To search in current directory only, use:

:vimgrep /^student_/ *.tcl

read more @ vim.wikia.com

Colyer answered 11/4, 2013 at 12:46 Comment(4)
As far as I understand this reg-exp search pattern inside files that have .tcl extensions? Is it ? But I would like search in all the files insed directory.Destinee
try it out. It searches recursively from current directory all files ending with .tcl and containing the string student. To search in current directory only, just use *.tcl. See updated answerColyer
wouldn't you want a backslash before the dot so as not to match any character?Abele
+1 for the vim answer! If someone wants to see how it worked or just got too many result in quickfix window, check the Gif here : github.com/sk1418/QFGrep. :D :DHerculaneum
T
4
grep "student_[[:alnum:]]*\.tcl" *
Timeless answered 11/4, 2013 at 12:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.