Linux – Using diff on a long one line file

diff()linux

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?

Best 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