Comparing Files in Linux
sdiff, much like it's counter part diff, provides a great way to compare files in GNU/Linux! A good mnumonic to remember the command is by thinking of it as the "side-by-side merge of file differences." Here's an example of how it works.First, create two files, beginning with
textfile1:Apples
Oranges
Bananas... and the second file,
textfile2:Apples
Oranges
Strawberries
BananasWith two files to compare, let's run
sdiff on them:$ sdiff --width 10 textfile1 textfile2
Apples Apples
Oranges Oranges
> Strawberr
Bananas Bananassdiff contains a few additional features of interest:--output=FILE--ignore-case--ignore-all-space
And that's it, so remember: When you need to quickly compare files in Linux,
sdiff is a convenient method!

No comments:
Post a Comment