Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've 2 configuration files in linux. One file size is 177bytes and 2nd one is 183 bytes. Checked size by following command:

wc -c Config

both files have 100% same text, same name (different folders). I matched word by word as there are only 6 lines. Also compared by using CompareIT in windows. Now problem is that when I run my program with Config file of 177 bytes, then it works. and when I run my program with Config file of size 183 then it doesn't work. Now I'm unable to understand that how can I distinguish between both files? what is the difference that is creating problem as i have to keep checking every time that I'm using file of 177 bytes. that configuration files contains:

Company="ABC"
FromEmail="Email"
UserName="user"
Password="Pass"
ToEmail="Email"
SMTP=smtp.gmail.com:587

Kindly help me to identify difference. thanks in advance.

share|improve this question

3 Answers 3

up vote 3 down vote accepted

The difference is probably just white space. Open up each in a hex editor to verify.

share|improve this answer
2  
I'm venture a guess that one has LF line endings, while the other has CRLF endings. –  Shane Madden Apr 29 '12 at 2:29

The difference is either in whitespace or the newline char.

On windows, the newline char (char that gets you in the new line). On unix systems, it simply \n. On windows systems it's \r\n (carriage-return, newline (linefeed)).

Check it with the hex editor, or find "dos2unix" tool to convert and then compare with "diff".

If one of the files was created on Windows and the other on a unix box, that would probably be the difference.

share|improve this answer

We have the technology to show the difference between two files automagically. diff is the canonical option, and will show you which lines are different (so you can narrow down your search). cmp, in contrast, won't give you such friendly output, but it does tell you exactly which byte in the file is different.

I'd say, however, that any program that barfs just because whitespace has changed in it's config file probably is one you want to be running away from very quickly (preferably after putting the author of said nightmare out of their misery -- for the sake of anyone else who might come across them in the future, if nothing else).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.