Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, I have a word called 'CRIS' in some file. I dont know the file name also. But i want to list all the files which contaions the word 'CRIS'. ...
  1. #1
    Just Joined!
    Join Date
    Jan 2010
    Posts
    3

    how to find the text inside a file.

    Hi,

    I have a word called 'CRIS' in some file.
    I dont know the file name also.
    But i want to list all the files which contaions the word 'CRIS'.
    How can i search for the file which contains that word.

    Thanks

  2. #2
    Linux Enthusiast meton_magis's Avatar
    Join Date
    Oct 2006
    Location
    arizona
    Posts
    665
    use grep.

    grep -r "CRIS" /path/to/directory
    New to the internet, technical forums, or the hacker / open source community??
    Read this to learn good posting habits http://www.catb.org/~esr/faqs/smart-questions.html

    RHCE for RHEL version 5
    RHCT for RHEL version 4

  3. #3
    Just Joined!
    Join Date
    Jun 2009
    Posts
    42
    If you just want to find the filename. You can use the -l switch. You might also add -i for case insensitive.
    # grep -lr "CRIS" /path

Posting Permissions

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