1*37a8a615Sjsg.\" $OpenBSD: sdiff.1,v 1.20 2022/07/25 02:25:55 jsg Exp $ 2228e906dStedu.\" 3228e906dStedu.\" Written by Raymond Lai <ray@cyth.net>. 4228e906dStedu.\" Public domain. 5228e906dStedu.\" 6*37a8a615Sjsg.Dd $Mdocdate: July 25 2022 $ 7228e906dStedu.Dt SDIFF 1 8228e906dStedu.Os 9228e906dStedu.Sh NAME 10228e906dStedu.Nm sdiff 11228e906dStedu.Nd side-by-side diff 12228e906dStedu.Sh SYNOPSIS 13228e906dStedu.Nm 14618b0722Stedu.Op Fl abdilstW 15228e906dStedu.Op Fl I Ar regexp 16228e906dStedu.Op Fl o Ar outfile 17228e906dStedu.Op Fl w Ar width 18228e906dStedu.Ar file1 19228e906dStedu.Ar file2 20228e906dStedu.Sh DESCRIPTION 21e59e7544Sray.Nm 22e59e7544Sraydisplays two files side by side, 23e59e7544Sraywith any differences between the two highlighted as follows: 24e59e7544Sraynew lines are marked with 259dbd6965Sbentley.Sq > ; 26e59e7544Sraydeleted lines are marked with 279dbd6965Sbentley.Sq < ; 28e59e7544Srayand changed lines are marked with 299dbd6965Sbentley.Sq | . 30e59e7544Sray.Pp 31e59e7544Sray.Nm 32e59e7544Sraycan also be used to interactively merge two files, 33e59e7544Srayprompting at each set of differences. 34e59e7544SraySee the 35e59e7544Sray.Fl o 36e59e7544Srayoption for an explanation. 37228e906dStedu.Pp 38228e906dSteduThe options are: 39228e906dStedu.Bl -tag -width Ds 40228e906dStedu.It Fl l 416c5dcafeSjmcOnly print the left column for identical lines. 42228e906dStedu.It Fl o Ar outfile 43228e906dSteduInteractively merge 44228e906dStedu.Ar file1 45228e906dSteduand 46228e906dStedu.Ar file2 47228e906dSteduinto 48228e906dStedu.Ar outfile . 49228e906dSteduIn this mode, the user is prompted for each set of differences. 5050561fc4SjmcSee 5150561fc4Sjmc.Ev EDITOR 5250561fc4Sjmcand 5350561fc4Sjmc.Ev VISUAL , 5450561fc4Sjmcbelow, 5550561fc4Sjmcfor details of which editor, if any, is invoked. 56228e906dStedu.Pp 576c5dcafeSjmcThe commands are as follows: 58228e906dStedu.Bl -tag -width Ds 5925e891c2Sjmc.It Cm l | 1 60228e906dSteduChoose left set of diffs. 6125e891c2Sjmc.It Cm r | 2 62228e906dSteduChoose right set of diffs. 63228e906dStedu.It Cm s 64228e906dSteduSilent mode \(en identical lines are not printed. 65228e906dStedu.It Cm v 66228e906dSteduVerbose mode \(en identical lines are printed. 67228e906dStedu.It Cm e 68228e906dSteduStart editing an empty file, which will be merged into 69228e906dStedu.Ar outfile 70228e906dSteduupon exiting the editor. 71228e906dStedu.It Cm e Cm l 72228e906dSteduStart editing file with left set of diffs. 73228e906dStedu.It Cm e Cm r 74228e906dSteduStart editing file with right set of diffs. 75228e906dStedu.It Cm e Cm b 76228e906dSteduStart editing file with both sets of diffs. 77228e906dStedu.It Cm q 78228e906dSteduQuit 79228e906dStedu.Nm . 80228e906dStedu.El 81228e906dStedu.It Fl s 82228e906dSteduSkip identical lines. 83228e906dStedu.It Fl w Ar width 84228e906dSteduPrint a maximum of 85228e906dStedu.Ar width 86228e906dSteducharacters on each line. 87228e906dSteduThe default is 130 characters. 88228e906dStedu.El 89228e906dStedu.Pp 90228e906dSteduOptions passed to 91228e906dStedu.Xr diff 1 92228e906dSteduare: 93228e906dStedu.Bl -tag -width Ds 94228e906dStedu.It Fl a 95228e906dSteduTreat 96228e906dStedu.Ar file1 97228e906dSteduand 98228e906dStedu.Ar file2 99228e906dSteduas text files. 100228e906dStedu.It Fl b 101228e906dSteduIgnore trailing blank spaces. 102228e906dStedu.It Fl d 103228e906dSteduMinimize diff size. 104228e906dStedu.It Fl I Ar regexp 105228e906dSteduIgnore line changes matching 106228e906dStedu.Ar regexp . 10782aa626aSjmcAll lines in the change must match 10882aa626aSjmc.Ar regexp 10982aa626aSjmcfor the change to be ignored. 110228e906dStedu.It Fl i 111228e906dSteduDo a case-insensitive comparison. 112228e906dStedu.It Fl t 113228e906dSteduExpand tabs to spaces. 114228e906dStedu.It Fl W 1156c5dcafeSjmcIgnore all spaces 1166c5dcafeSjmc(the 117228e906dStedu.Fl w 118228e906dSteduflag is passed to 1196c5dcafeSjmc.Xr diff 1 ) . 120228e906dStedu.El 12150561fc4Sjmc.Sh ENVIRONMENT 12250561fc4Sjmc.Bl -tag -width Ds 12350561fc4Sjmc.It Ev EDITOR , VISUAL 12450561fc4SjmcSpecifies an editor to use with the 12550561fc4Sjmc.Fl o 12650561fc4Sjmcoption. 12750561fc4SjmcIf both 12850561fc4Sjmc.Ev EDITOR 12950561fc4Sjmcand 13050561fc4Sjmc.Ev VISUAL 13150561fc4Sjmcare set, 13250561fc4Sjmc.Ev VISUAL 13350561fc4Sjmctakes precedence. 13450561fc4SjmcIf neither 13550561fc4Sjmc.Ev EDITOR 13650561fc4Sjmcnor 13750561fc4Sjmc.Ev VISUAL 13850561fc4Sjmcare set, 13950561fc4Sjmcthe default is 14050561fc4Sjmc.Xr vi 1 . 1419c3b0b15Sjmc.It Ev TMPDIR 1429c3b0b15SjmcSpecifies a directory for temporary files to be created. 1439c3b0b15SjmcThe default is 1449c3b0b15Sjmc.Pa /tmp . 14550561fc4Sjmc.El 14698aab279Sjmc.Sh EXIT STATUS 14798aab279SjmcThe 14898aab279Sjmc.Nm 14998aab279Sjmcutility exits with one of the following values: 15098aab279Sjmc.Pp 15198aab279Sjmc.Bl -tag -width Ds -offset indent -compact 15298aab279Sjmc.It 0 15398aab279SjmcNo differences were found. 15498aab279Sjmc.It 1 15598aab279SjmcDifferences were found. 15698aab279Sjmc.It \*(Gt1 15798aab279SjmcAn error occurred. 15898aab279Sjmc.El 159d7f7052aSjmc.Sh SEE ALSO 1606272b51eSjasper.Xr cmp 1 , 161d7f7052aSjmc.Xr diff 1 , 16250561fc4Sjmc.Xr diff3 1 , 16382aa626aSjmc.Xr vi 1 , 16482aa626aSjmc.Xr re_format 7 165f273b081Sschwarze.Sh HISTORY 166*37a8a615SjsgThe 167f273b081Sschwarze.Nm 168*37a8a615Sjsgcommand first appeared in 169*37a8a615Sjsg.At III 170*37a8a615Sjsgand was reimplemented for 171f273b081Sschwarze.Ox 3.9 . 1726c5dcafeSjmc.Sh AUTHORS 1736c5dcafeSjmc.Nm 1746c5dcafeSjmcwas written from scratch for the public domain by 17576c04420Sschwarze.An Ray Lai Aq Mt ray@cyth.net . 176228e906dStedu.Sh CAVEATS 177228e906dSteduAlthough undocumented, 178228e906dStedu.Nm 179b392b870Sjmcsupports most long options supported by GNU sdiff, 180b392b870Sjmcthough some require GNU diff. 181228e906dStedu.Pp 182228e906dSteduTabs are treated as anywhere from one to eight characters wide, 183228e906dStedudepending on the current column. 184228e906dSteduTerminals that treat tabs as eight characters wide will look best. 1856b9f4b67Sray.Sh BUGS 1866b9f4b67Sray.Nm 1876b9f4b67Sraymay not work with binary data. 188