cancel
Showing results for 
Search instead for 
Did you mean: 

Compare windows and unix files, ignore line endings

SOLVED
Occasional Contributor

Compare windows and unix files, ignore line endings

Hello,

 

My testing application is exporting some files in windows and other files in unix format. I want to compare those files with reference files using the files.compare method. But every time the test gives error saying the files are not equal. They are equal, except the format, windows/unix, the line endings are different. And when I try to save the reference files in other format, our version system doesn't keep that change. 

 

Is there a way to compare windows files with unix files, ignoring the line endings?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Occasional Contributor

Re: Compare windows and unix files, ignore line endings

Already found out how to do it. It's a bit ugly to replace the file line by line and then compare the replaced file with the reference file, but if it works..

3 REPLIES 3
Community Hero

Re: Compare windows and unix files, ignore line endings

Hi,

 

As an option: post-process exported file and replace line ands to required format. Then compare with the reference file.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Occasional Contributor

Re: Compare windows and unix files, ignore line endings

Thanks. Can you tell me how I can replace line endings? I found this page for adjusting line breaks: https://support.smartbear.com/testcomplete/docs/reference/program-objects/utilities/adjustlinebreaks..., but apparently it is obsolete. 

I like to convert them from unix format [LF] to windows [CR][LF].

Highlighted
Occasional Contributor

Re: Compare windows and unix files, ignore line endings

Already found out how to do it. It's a bit ugly to replace the file line by line and then compare the replaced file with the reference file, but if it works..

New Here?
Join us and watch the welcome video:
Top Kudoed Authors