Find the answer to your Linux question:
Results 1 to 3 of 3
The following command is attempted to locate java files that contains string abc. Code: find *.java exec grep -il "abc"{} \ ; Error message: find: unknown predicate `-il'...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2012
    Posts
    6

    Command to look into files and search for a specific string


    The following command is attempted to locate java files that contains string abc.
    Code:
    find *.java exec grep -il "abc"{} \ ;
    Error message:
    find: unknown predicate `-il'

  2. #2
    rrl
    rrl is offline
    Just Joined!
    Join Date
    May 2011
    Location
    NJ
    Posts
    64
    edited for innacuracy
    Last edited by rrl; 11-10-2012 at 06:51 PM. Reason: innacuracy

  3. #3
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Quote Originally Posted by CPE2012 View Post
    Code:
    find *.java exec grep -il "abc"{} \ ;
    Error message:
    find: unknown predicate `-il'
    Try this:

    Code:
    find . -type f -iname '*.java' -exec grep -il "abc" {} \;
    Note the spaces and leading dashes that you omitted in your example.

Posting Permissions

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