How to use GREP/FIND to search a string in all the subdirectories and files
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: How to use GREP/FIND to search a string in all the subdirectories and files

Hybrid View

  1. #1
    Join Date
    Oct 2000
    Posts
    3
    Hi

    Could anyone know how to use the unix GREP/FIND to find a string in all the files and directories(including subdirectories and files)

    there are some hardcoded IP's at the server level, so i need to find the string in all the files, starting from root.

    any ideas ????

    thanx in advance..


    sravan

  2. #2
    Join Date
    Aug 2000
    Location
    Belgium
    Posts
    342

    Thumbs up

    use

    find / -type f -exec grep -l "IP" {} \;

    why ?

    find / -type f -> find all files starting from /
    find .... -exec -> for each item found, do the following command. Where you normally place the filename in you command, put {} .
    grep -l "IP" something -> returns the filename if string "IP" is found in file something

    Hope this helps
    Gert



  3. #3
    Join Date
    Oct 2000
    Posts
    3

    re:

    Thanx!!! for your advice.... it helped me a lot.

Posting Permissions

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



Click Here to Expand Forum to Full Width