Saturday, 5 November 2016

How to grep only filenames that match?

Q.66 How to grep only filenames that match?

grep is used to search within a file to see if any line matches a given regular expression. 
For example, if you want to find all VB form files that start with an "f" and end with .frm, 

You need to use find instead of grep in this case.
You can also use find in combination with grep or egrep:

$ find | grep "f[[:alnum:]]\.frm"

No comments:

Post a Comment

Tricks and Tips