This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes compare contents of two files using regex Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "compare contents of two files using regex" Watch "compare contents of two files using regex" New topic
Author

compare contents of two files using regex

Kamal Ahmed
Ranch Hand

Joined: Feb 15, 2005
Posts: 91
Hi,
Could anyone give me some hint, as to how i can compare two files which are contain lines using the following encoding schemes:


US-ASCII
ISO-8859-1
UTF-8 Eight-bit
UTF-16BE Sixteen-bit
UTF-16LE Sixteen-bit
UTF-16 Sixteen-bit UCS


Let me know if further information is required.
I would appreciate ANY hint/help

Thanks,
-Kamal.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41633
    
  55
What do you mean by compare - do you want to know which lines are added or omitted from one or the other file (in which case one of the numerous "diff"-like tools would do the trick), or do you need to compare the contents of individual lines as well?


Ping & DNS - my free Android networking tools app
Kamal Ahmed
Ranch Hand

Joined: Feb 15, 2005
Posts: 91
need to compare the contents of individual lines , one example of a line is:

WEBMETHODS: localhost ort - (WEBMETHODS.DEFAULT.TestComponentId.TestSubcomponentId) [TestComponentId.TestSubcomponentId.?] 2006-08-08 18:15:56.169 EDT INFO: ?


I could not paste the UTF-16 format here
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41633
    
  55
OK, so say you have two lines that look just about like the one you posted - what should be the desired output? Would those two lines you're comparing be in the same file, or in different files?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: compare contents of two files using regex