Tuesday, April 30, 2024
10
rated 0 times [  10] [ 0]  / answers: 1 / hits: 190025  / 2 Years ago, sat, march 5, 2022, 10:55:24

Suppose that I have a directory with name _file and includes two sub directory like _1 and _2 and on each one I have some text files. I want to search a word like foo in one of these text files. How I can do that?
I want to know which text files in the whole directory contain that word?


More From » command-line

 Answers
1

  1. Open a terminal.

  2. Install ack-grep by typing sudo apt-get install ack-grep

  3. Change to the directory you want to search under, and type ack-grep foo. it lists out all the matches in all files under that directory.


[#25374] Sunday, March 6, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
diffeah

Total Points: 78
Total Questions: 130
Total Answers: 98

Location: Peru
Member since Fri, Oct 14, 2022
2 Years ago
;