Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a file that has only one line. Its size is about 20,000 bytes.

The file has been modified, and I wanted to know where.

I thought using diff, but it shows me the complete line, because it outputs the line that has the difference - but in this case it's the only line in the file that has differences.

So I wanted to see what is the difference.

Any advice?

share|improve this question
1  
Diff word by word? manpages.ubuntu.com/manpages/lucid/man1/wdiff.1.html –  VenkatH Oct 30 '12 at 17:42
2  
have you tried piping it to fmt (if you ar using linux of course) you could do "fmt -w 50 long.txt|diff" –  l1zard Oct 30 '12 at 17:42
1  
What platform/OS? –  Rich Homolka Oct 30 '12 at 17:50
    
sorry, I forgot to mention I'm on linux (ubuntu) –  jperelli Oct 30 '12 at 17:56

3 Answers 3

I'd find a diff that does intra-line diffs. I use xxdiff on UNIX. I think WinMerge does intra-line diff on Windows.

The other answers are good as well: wdiff, or breaking into chunks - the chunk boundaries are easier to define if the data is delimited by say a pipe or a comma.

share|improve this answer

Assuming that there are many whitespaces, as in normal text, you can split the file by words and compare it with a normal diff tool, for example, meld:

tr -s ' ' '\n' < file1.txt > file1.txt.split
tr -s ' ' '\n' < file2.txt > file2.txt.split
meld file1.txt.split file2.txt.split
share|improve this answer

If this is a one-time problem, I'd create copies of the files with \n characters inserted every 50 characters, then diff those copies. (I chose 50 because it makes the math easy going from differing line number to byte offset in the original files but might adjust that up/down based on what I found.)

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.