Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, How can i find a specific string pattern in the entire tree(several directories containing multiple sub directories ) ? $ find ./ -type f |grep "<pattern>" will not do ...
  1. #1
    Just Joined! amit4g's Avatar
    Join Date
    Feb 2007
    Location
    Bangalore,India
    Posts
    63

    locating a string pattern in a tree

    Hi,

    How can i find a specific string pattern in the entire tree(several directories containing multiple sub directories ) ?
    $ find ./ -type f |grep "<pattern>" will not do as it will just give the names of directories (relative pathname containing the pattern).

    grepping for the pattern in a directory containing files only work,but this is not what i want.
    i need to look for the specific <pattern> in the entire tree .

    "xargs" might do the job,but i've never used it before : (

    Thanks,
    ~amit

  2. #2
    Just Joined! amit4g's Avatar
    Join Date
    Feb 2007
    Location
    Bangalore,India
    Posts
    63
    i guess i found what i was looking for
    find ./ -type f|xargs grep <pattern>|more

Posting Permissions

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