View the Most Wanted LQ Wiki articles.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


Search this Thread
Old 10-14-2004, 04:25 AM   #1
Registered: Jun 2004
Posts: 51

Rep: Reputation: 15
how to compare 2 text files by using php code

Hi all,

how to compare 2 text files by using php code and return the difference result??

is it regexp can help to do the comparison?

finally would anyone can provide me some references?

or any suggestion

Many thx !!!

Old 10-14-2004, 04:54 AM   #2
Registered: Aug 2002
Posts: 12,488

Rep: Reputation: 886Reputation: 886Reputation: 886Reputation: 886Reputation: 886Reputation: 886Reputation: 886
BTW is this a homework assignment?

Last edited by michaelk; 10-14-2004 at 04:56 AM.
Old 10-14-2004, 05:01 AM   #3
Registered: Jun 2004
Posts: 51

Original Poster
Rep: Reputation: 15
sorry what is BTW!!

I am not familiar with php !!

I am building a web application !! I just want to know any reference or example by using regular expression or other kind of method to compare to text file. and then highlight it and output it in form of HTML!!
Old 10-14-2004, 05:52 AM   #4
Registered: Jun 2004
Posts: 51

Original Poster
Rep: Reputation: 15
hi all,
I find other solution to solve my problem.
and would like to share my method to you.

I am now using the linux command "diff" to compare 2 file and parse the output file and then generate the HTML code.

example :
diff a.txt b.txt > result.txt

Last edited by antony_csf; 10-14-2004 at 05:54 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Code to check how many users are downloading files. farmerjoe Programming 8 04-01-2005 03:23 PM
PHP code did not create a cookie and it did not changed the background and text color Linh Programming 5 07-29-2004 10:15 PM
Need text pattern compare script kscott121 Linux - Software 4 05-10-2004 01:13 PM
How to compare these two strings in one line code? powerplane Programming 4 07-10-2003 12:09 AM
PHP Code to retriev e binary log files saravanan1979 Programming 1 03-28-2002 12:14 AM

All times are GMT -5. The time now is 01:30 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration