sdiff command in Linux with Examples
sdiff command in linux is used to compare two files and then writes the results to standard output in a side-by-side format. It displays each line of the two files with a series of spaces between them if the lines are identical. It displays greater than sign if the line only exists in the file specified by the File2 parameter, and a | (vertical bar) for lines that are different.
Syntax:
sdiff [ -l | -s ] [ -o OutFile ] [ -w Number ] File1 File2
Example:
Text File 1:
Geeks For Geeks A Computer Science Portal For Geeks
Text File 2:
Geeks For Geeks Technical Scripter 2018
Options of sdiff command:
sdiff -l file1 file2: It displays only the left side when lines are identical.

-
sdiff -s file1 file2: It does not display the identical identical lines.

sdiff -w Number file1 file2: It sets the width of the output line. The default value of the Number variable is 130 characters. The maximum width of the Number variable is 2048. The minimum width of the Number variable is 20. The sdiff command uses 2048 if a value greater than 2048 is specified.

sdiff -o OutFile file1 file2: Creates a third file, specified by the OutFile variable, by a controlled line-by-line merging of the two files specified by the File1 and the File2 parameters. The following subcommands govern the creation of this file:

Output File:Geeks For Geeks --- geek1.txt 5, 10 A Computer Science Portal For Geeks +++ geek2.txt 5, 8 Technical Scripter 2018
Reference: https://www.tecmint.com/linux-sdiff-command-examples/
Recommended Posts:
- df Command in Linux with examples
- ssh command in Linux with Examples
- tee command in Linux with examples
- cd command in Linux with Examples
- ed command in Linux with examples
- for command in Linux with Examples
- last command in Linux with Examples
- gdb command in Linux with examples
- look command in Linux with Examples
- help Command in Linux with examples
- df command in Linux with Examples
- Cat command in Linux with examples
- du command in Linux with examples
- rev command in Linux with Examples
- cpp command in Linux with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



