Find the answer to your Linux question:
Results 1 to 2 of 2
Hello all Im doing search in jar files using this oneLiener : Code: find . -name "*.jar" -print -exec jar -tvf {} \; | grep -n \/Participant.class but I also ...
  1. #1
    Just Joined!
    Join Date
    Dec 2007
    Posts
    7

    How to print the files names that being searched

    Hello all
    Im doing search in jar files using this oneLiener :
    Code:
    find . -name "*.jar"  -print -exec jar -tvf {} \; | grep -n \/Participant.class
    but I also will like to see the jar file names that the grep succeed the search
    What I need to add to this command so it will give the file names?

  2. #2
    Linux Enthusiast
    Join Date
    Aug 2006
    Posts
    631
    You can place a tee command between the find and the grep command to write the output of the find command to a file:

    Code:
    find ... | tee -a file | grep -n ...
    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...