search&return a string (maybe grep)

Discussion in 'PHP' started by phpone, Apr 5, 2009.

  1. #1
    Hi,
    i'm about a newbie about php.
    I'm trying to get a search script in order to find and print the row that contain the searched string.
    How can i do?
    I have a log file that contain a list of data
    "date time name email"
    i need to search any of these data (a name or a number) and get whole row containing that.
    By now i'm using a pre-made script using perl, but i'm moving sites and i cannot run perl.
    I've tried using some scripts found on the net but without any result

    Thanks in advance for the support,
    Regards
     
    phpone, Apr 5, 2009 IP
  2. mad-monkey

    mad-monkey Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If your searching through a file, check this out: http://www.niblr.com/php-flat-file-search-script/

    It's not going to be very intelligent though, because we don't know how this log file is constructed, what kind of log file it is, and if you want to search for particular fields. If your just doing a flat file search, then that's easy.
     
    mad-monkey, Apr 5, 2009 IP