Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

i want find a words in file

Discussion in 'General Discussion' started by moalim, Dec 25, 2003.

  1. moalim

    moalim Active Member

    Joined:
    Jun 24, 2003
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    156
    HI

    how can i find a words in file for SSH COMMANDS


    example:
    -------
    cat /home/*/public_html /*. php
    -------
    this command find all php's files on server

    i want find words in files too


    THANKS
     
    #1 moalim, Dec 25, 2003
    Last edited: Dec 25, 2003
  2. kris1351

    kris1351 Well-Known Member

    Joined:
    Apr 18, 2003
    Messages:
    963
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Lewisville, Tx
    You can do grep <word> <file> and this will search for a particular word or string in a file. grep -i ignores the case of lettering.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. moalim

    moalim Active Member

    Joined:
    Jun 24, 2003
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    156
    ok

    i was typed

    ----------------
    root@server7 [~]# Gerp "ner" *.php
    -bash: Gerp: command not found
    root@server7 [~]#
    ----------

    where is rong ?
     
  4. kris1351

    kris1351 Well-Known Member

    Joined:
    Apr 18, 2003
    Messages:
    963
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Lewisville, Tx
    ----------------
    root@server7 [~]# Gerp "ner" *.php
    -bash: Gerp: command not found
    root@server7 [~]#


    should be grep ner *.php instead of Gerp.

    or it could be

    grep -i ner *.php
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. moalim

    moalim Active Member

    Joined:
    Jun 24, 2003
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    156
    :eek:

    root@server7 [~]# grep ner *.php
    grep: *.php: No such file or directory
    root@server7 [~]# grep -i ner *.php
    grep: *.php: No such file or directory
     
  6. asmithjr

    asmithjr Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    510
    Likes Received:
    5
    Trophy Points:
    168
    if you want to search files in directories below the current directory then use grep -r ner *.php.

    It will search recursively
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. moalim

    moalim Active Member

    Joined:
    Jun 24, 2003
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    156
    i want to search words in PHP files in HOME directory


    +++++
    root@server7 [/home]# Gerp "ner" *.php
    -bash: Gerp: command not found
    root@server7 [/home]# grep ner *.php
    grep: *.php: No such file or directory
    root@server7 [/home]# grep -r ner *.php.
    grep: *.php.: No such file or directory
    root@server7 [/home]# grep -r ner *.php
    grep: *.php: No such file or directory


    +++++
    THANKS ALOT FOR HELP ME
     
  8. asmithjr

    asmithjr Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    510
    Likes Received:
    5
    Trophy Points:
    168
    sounds like you do not have any php files in the directory you are running the command from.

    cd /home

    grep -r word *

    where word is the word you want to find.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice