1.\" $OpenBSD: sdiff.1,v 1.19 2017/10/17 22:47:58 schwarze Exp $ 2.\" 3.\" Written by Raymond Lai <ray@cyth.net>. 4.\" Public domain. 5.\" 6.Dd $Mdocdate: October 17 2017 $ 7.Dt SDIFF 1 8.Os 9.Sh NAME 10.Nm sdiff 11.Nd side-by-side diff 12.Sh SYNOPSIS 13.Nm 14.Op Fl abdilstW 15.Op Fl I Ar regexp 16.Op Fl o Ar outfile 17.Op Fl w Ar width 18.Ar file1 19.Ar file2 20.Sh DESCRIPTION 21.Nm 22displays two files side by side, 23with any differences between the two highlighted as follows: 24new lines are marked with 25.Sq > ; 26deleted lines are marked with 27.Sq < ; 28and changed lines are marked with 29.Sq | . 30.Pp 31.Nm 32can also be used to interactively merge two files, 33prompting at each set of differences. 34See the 35.Fl o 36option for an explanation. 37.Pp 38The options are: 39.Bl -tag -width Ds 40.It Fl l 41Only print the left column for identical lines. 42.It Fl o Ar outfile 43Interactively merge 44.Ar file1 45and 46.Ar file2 47into 48.Ar outfile . 49In this mode, the user is prompted for each set of differences. 50See 51.Ev EDITOR 52and 53.Ev VISUAL , 54below, 55for details of which editor, if any, is invoked. 56.Pp 57The commands are as follows: 58.Bl -tag -width Ds 59.It Cm l | 1 60Choose left set of diffs. 61.It Cm r | 2 62Choose right set of diffs. 63.It Cm s 64Silent mode \(en identical lines are not printed. 65.It Cm v 66Verbose mode \(en identical lines are printed. 67.It Cm e 68Start editing an empty file, which will be merged into 69.Ar outfile 70upon exiting the editor. 71.It Cm e Cm l 72Start editing file with left set of diffs. 73.It Cm e Cm r 74Start editing file with right set of diffs. 75.It Cm e Cm b 76Start editing file with both sets of diffs. 77.It Cm q 78Quit 79.Nm . 80.El 81.It Fl s 82Skip identical lines. 83.It Fl w Ar width 84Print a maximum of 85.Ar width 86characters on each line. 87The default is 130 characters. 88.El 89.Pp 90Options passed to 91.Xr diff 1 92are: 93.Bl -tag -width Ds 94.It Fl a 95Treat 96.Ar file1 97and 98.Ar file2 99as text files. 100.It Fl b 101Ignore trailing blank spaces. 102.It Fl d 103Minimize diff size. 104.It Fl I Ar regexp 105Ignore line changes matching 106.Ar regexp . 107All lines in the change must match 108.Ar regexp 109for the change to be ignored. 110.It Fl i 111Do a case-insensitive comparison. 112.It Fl t 113Expand tabs to spaces. 114.It Fl W 115Ignore all spaces 116(the 117.Fl w 118flag is passed to 119.Xr diff 1 ) . 120.El 121.Sh ENVIRONMENT 122.Bl -tag -width Ds 123.It Ev EDITOR , VISUAL 124Specifies an editor to use with the 125.Fl o 126option. 127If both 128.Ev EDITOR 129and 130.Ev VISUAL 131are set, 132.Ev VISUAL 133takes precedence. 134If neither 135.Ev EDITOR 136nor 137.Ev VISUAL 138are set, 139the default is 140.Xr vi 1 . 141.It Ev TMPDIR 142Specifies a directory for temporary files to be created. 143The default is 144.Pa /tmp . 145.El 146.Sh EXIT STATUS 147The 148.Nm 149utility exits with one of the following values: 150.Pp 151.Bl -tag -width Ds -offset indent -compact 152.It 0 153No differences were found. 154.It 1 155Differences were found. 156.It \*(Gt1 157An error occurred. 158.El 159.Sh SEE ALSO 160.Xr cmp 1 , 161.Xr diff 1 , 162.Xr diff3 1 , 163.Xr vi 1 , 164.Xr re_format 7 165.Sh HISTORY 166.Nm 167has been available since 168.Ox 3.9 . 169.Sh AUTHORS 170.Nm 171was written from scratch for the public domain by 172.An Ray Lai Aq Mt ray@cyth.net . 173.Sh CAVEATS 174Although undocumented, 175.Nm 176supports most long options supported by GNU sdiff, 177though some require GNU diff. 178.Pp 179Tabs are treated as anywhere from one to eight characters wide, 180depending on the current column. 181Terminals that treat tabs as eight characters wide will look best. 182.Sh BUGS 183.Nm 184may not work with binary data. 185