Linux grep-like in php

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 3
Joined: Mon Nov 19, 2012 8:56 am

Linux grep-like in php

Postby shay » Mon Nov 19, 2012 8:59 am

Hi All,

I'm a newbie to php.

I'm looking for a solution of grepping out lines (from a text file) that contains a phrase that users provide.

for example, a user enters their username and the php script should search all lines that contains that username's name.

I was told to first use the 'get_file_content' method in order to first get the content of the file and encountered a problem already.

My text file is a Linux sendmail log file that contains the following phrases 'to=<>',
the 'get_file_content' seem to ignore the < and > characters so here is what left from the above phrase "to=", the < and what comes after is omitted.

Your help is appreciated

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 7 guests