We had two versions of a not-really-intended-to-be-human-readable file that were only slightly different, and we wanted to know how they were different. The lines were several hundred characters long, so when we
diffed the files, we saw a basically useless output of
@@ -1 +1 @@ - bf659d7a2e0e45223095367c561526f8a10311459433adf322f2590a4987c423e55afe6e88abb09f0bee39549f1dfbbdfba99e39c0b70a7a656d07061ee113676f0d6db25d88c8034db6d9d8beec42daaaf8818273d9436fca8f442cdb6245c285c33638 + bf659d7a2e0e45223095367c561526f8a10311459433adf322f2590a4987c423e55afe6e88abb09f0bee39549f1dfbbdfba99e39c0b70a7a656d07061ee113676f0d6db25d88c8034db6d9d8beec42daaaf8818278d9436fca8f442cdb6245c285c33638
My usual trick of opening the file in Vim and using
gq didn’t work because there was no whitespace in the string, and Vim (at least in my configuration) will only split on whitespace.
Text-wrapping is certainly not a new problem — surely there’s a Unix utility for that, I thought. And sure enough,
fold was there to help.
After folding at an arbitrary length of 25 characters (with
fold -w 25 $FILE), the diff output became readable and thus useful:
@@ -4,5 +4,5 @@ bb09f0bee39549f1dfbbdfba9 9e39c0b70a7a656d07061ee11 3676f0d6db25d88c8034db6d9 -d8beec42daaaf8818273d9436 +d8beec42daaaf8818278d9436 fca8f442cdb6245c285c33638
Now can you see the 3 that turned into an 8?
(Of course, this whole situation could have been avoided if we tried to make that output human-readable in the first place. Live and learn!)
About the AuthorMore Content by Mark Rushakoff