1
grep -nr 'queryTag' . 

For example, I have a number of directories in the current directory, and I want to search for the keyword 'queryTag'. However, I want to restrict the search to the file type '.txt', not all the file in the current directory. How to modify the command above?

1 Answer 1

2

You can use --include= option:

grep -nr 'queryTag' --include='*.txt' . 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.