Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2006

    Locating file which contain specific text (syntax)

    I'm trying to locate a file in the server which contain one of the line:

    if(!socket_sendto($sock,$data,strlen($data),0,$target,$port)) die("Error SendTo!!!");

    How is that possible using find & grep command, or better suggestion?

  2. #2
    Join Date
    Mar 2009
    If you have no idea where in the filesystem it's located, cd to / and do the following . . . it may take a while
    grep -R 'if(\!socket_sendto($sock,$data,strlen($data),0,$target,$port)) die(\"Error SendTo\!\!\!\");' *
    If you've got an idea, start at the highest point in the filesystem hierarchy that you can to save time. Be sure to escape all of the special characters and use single quotes as I did in my example, or the shell will try to interpolate, etc, which will mess up the command.
    Ask me about CloudCentrum (coming soon) -- The complete, turn-key cloud software solution

  3. #3
    Join Date
    Nov 2004
    Better still, just use something like:

    grep -ri "error sendto" /home > file &

    and sit back and wait

    When it's done, the output is in a file and you can check the file. The problem with big complex search expression as in the one posted above is its too darn easy to get them completely wrong!

Similar Threads

  1. Replies: 2
    Last Post: 07-27-2009, 01:27 PM
  2. Quickly get specific text from a large file from another site?
    By scriptdaemon in forum Programming Discussion
    Replies: 0
    Last Post: 11-07-2007, 01:37 AM
  3. Need Help Locating A Specific Law or Policy
    By OnlineWebSales in forum Ecommerce Hosting & Discussion
    Replies: 2
    Last Post: 01-01-2007, 12:10 PM
  4. Replies: 1
    Last Post: 01-06-2005, 04:58 AM

Posting Permissions

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