How to recursively search for tar files and then search them (with xargs) #362
-
Thinking it might be useful to add question #359 and answer here for those who have similar questions. QuestionI'm searching for a phrase inside files that are themselves inside tar files which are scattered throughout a number of sub directories. $ ugrep -rl --include="*.tar" 'phrase' . What I get in output is: dir1/tarfile.tar
dir2/othertarfile.tar
dir2/anothertar.tar
dir3/tartar.tar What I want is not to see the name of the file inside the tar file that the phrase was in. For example:
AnswerUse If you want to recursively search for tar files only and then list the files in those that match a pattern: $ ug -rl -Otar "" | xargs ug -lz "PATTERN" This runs a ugrep to look for tar files recursively with I am using $ ugrep --sort -rl -Otar "" | xargs ugrep -lz "PATTERN" Note that the problem with using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Note: see answer in the question post. |
Beta Was this translation helpful? Give feedback.
Note: see answer in the question post.