A Unix-based command which is used to compare and or differentiate the two or more files. It can be used with several switches to modify its output of reporting, such as mentioning the files to compare, setting the width of the output display or controlling of the output reports.
- About sdiff: side-by-side merge of file differences
- Comes From : diffutils-2.8.1
- Configuration Files:
- Path: /usr/bin/sdiff
Examples:
1. To spot the differences of given files
# sdiff file1.txt file2.txt |
2. To operate interactively and send output to file
# sdiff file1 file2 –output=FILE |
3. To ignore the case
# sdiff -i file1 file2 # sdiff –ignore-case file1 file2 |
4. To ignore changes due to tab expansion
# sdiff -E file1 file2 # sdiff –ignore-tab-expansion file1 file2 |
5. To Ignore changes in the amount of white space
# sdiff -b file1 file2 # sdiff –ignore-space-change file1 file2 |
6. To Ignore all white space
# sdiff -W file1 file2 # sdiff –ignore-all-space file1 file2 |
7. To Ignore changes whose lines are all blank
# sdiff -B file1 file2 # sdiff –ignore-blank-lines file1 file2 |
8. To Ignore changes whose lines all match RE
# sdiff -I RE file1 file2 # sdiff –ignore-matching-lines=RE file1 file2 |
9. To strip trailing carriage return on input
# sdiff –strip-trailing-cr file1 file2 |
10. To treat all files as text
# sdiff -a file1 file2 # sdiff –text file1 file2 |
11. To Output at most NUM (default 130) columns per line
# sdiff -w 10 file1 file2 # sdiff –width=NUM 10 file1 file2 |
12. To output only the left column of common lines
# sdiff -l file1 file2 # sdiff –left-column file1 file2 |
13. To do not output common lines
# sdiff -s file1 file2 # sdiff –suppress-common-lines file1 file2 |
14. To expand tabs to spaces in output
# sdiff -t file1 file2 # sdiff –expand-tabs file1 file2 |
15. To Try hard to find a smaller set of changes
# sdiff -d file1 file2 # sdiff –minimal file1 file2 |
16. To assume large files and many scattered small changes
# sdiff -H file1 file2 # sdiff –speed-large-files file1 file2 |
17. To Use PROGRAM to compare files
# sdiff –diff-program=PROGRAM file1 file2 |
18. To get the version
# sdiff -v # sdiff –version |
18. To get the help
# sdiff –help |