Find the answer to your Linux question:
Results 1 to 6 of 6
How to find a word from different files in linux ? Is there any command like (find . / -name *****), that can search files in the system for a ...
  1. #1
    Just Joined!
    Join Date
    Dec 2010
    Posts
    3

    finding a word from different files in linux

    How to find a word from different files in linux ?
    Is there any command like (find . / -name *****), that can search files in the system for a particular word in Linux?
    Please help.....

  2. #2
    Just Joined!
    Join Date
    Dec 2010
    Location
    India
    Posts
    45
    Quote Originally Posted by anvin View Post
    How to find a word from different files in linux ?
    Is there any command like (find . / -name *****), that can search files in the system for a particular word in Linux?
    Please help.....

    find . -name <filename> will find the file with name <filename>
    however if u want to find word in this file you can use grep with xargs for example

    find . -name <filename> | xargs grep <word>

  3. #3
    Just Joined!
    Join Date
    Dec 2010
    Posts
    3
    Quote Originally Posted by Piyu_86 View Post
    find . -name <filename> will find the file with name <filename>
    however if u want to find word in this file you can use grep with xargs for example

    find . -name <filename> | xargs grep <word>
    thank you for the quick reply.
    i wanted to know if there is any command that could find the word (Eg.CAT) in my system, by listing th name of the files. I tried the Places->Search for files Option. But this is too slow. I am using Fedora 14.

  4. #4
    Just Joined!
    Join Date
    Dec 2010
    Location
    India
    Posts
    45
    your question is not clear to me can u give example
    what exactly you want

  5. #5
    Just Joined!
    Join Date
    Dec 2010
    Location
    India
    Posts
    45
    i guess u want the name of the files which have the word "CAT" in it
    u can do that using grep

    grep -iRn "CAT" *

    for more details on grep you can do check teh man page of grep

  6. #6
    Just Joined!
    Join Date
    Dec 2010
    Posts
    3
    Quote Originally Posted by Piyu_86 View Post
    i guess u want the name of the files which have the word "CAT" in it
    u can do that using grep

    grep -iRn "CAT" *

    for more details on grep you can do check teh man page of grep
    thankyou, this is what i was looking for.

Posting Permissions

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