Skip to content
This repository was archived by the owner on Jun 5, 2024. It is now read-only.

Commit d0b5da6

Browse files
colordiff and some more examples/links
1 parent d828e19 commit d0b5da6

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

whats_the_difference.md

+28-15
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* [cmp](#cmp)
66
* [diff](#diff)
77
* [Comparing Directories](#comparing-directories)
8+
* [colordiff](#colordiff)
89

910
<br>
1011

@@ -149,28 +150,22 @@ $ echo $?
149150
* ignoring difference in white spaces
150151
151152
```bash
152-
$ diff <(echo 'good day') <(echo 'good day')
153-
1c1
154-
< good day
155-
---
156-
> good day
157153
$ # -b option to ignore changes in the amount of white space
158154
$ diff -b <(echo 'good day') <(echo 'good day')
159155
$ echo $?
160156
0
161157
162-
$ diff <(echo 'hi there ') <(echo ' hi there')
163-
1c1
164-
< hi there
165-
---
166-
> hi there
167158
$ # -w option to ignore all white spaces
168159
$ diff -w <(echo 'hi there ') <(echo ' hi there')
169160
$ echo $?
170161
0
171162
$ diff -w <(echo 'hi there ') <(echo 'hithere')
172163
$ echo $?
173164
0
165+
166+
# use -B to ignore only blank lines
167+
# use -E to ignore changes due to tab expansion
168+
# use -z to ignore trailing white spaces at end of line
174169
```
175170
176171
* side-by-side output
@@ -299,21 +294,39 @@ diff -r dir1/i1 dir2/i1
299294
diff -r dir1/subdir/f1 dir2/subdir/f1
300295
```
301296
302-
* See [GNU diffutils manual - comparing directories](https://www.gnu.org/software/diffutils/manual/diffutils.html#Comparing-Directories) for further options and details like excluding files, ignoring filename case, etc
297+
* See also [GNU diffutils manual - comparing directories](https://www.gnu.org/software/diffutils/manual/diffutils.html#Comparing-Directories) for further options and details like excluding files, ignoring filename case, etc and `dirdiff` command
303298
304299
<br>
305300
306-
*More to come*
301+
#### <a name="colordiff"></a>colordiff
302+
303+
```bash
304+
$ whatis colordiff
305+
colordiff (1) - a tool to colorize diff output
306+
307+
$ whatis wdiff
308+
wdiff (1) - display word differences between text files
309+
```
310+
311+
* simply replace `diff` with `colordiff`
312+
313+
![colordiff](./images/colordiff.png)
314+
315+
* or, pass output of a `diff` tool to `colordiff`
316+
317+
![wdiff to colordiff](./images/wdiff_to_colordiff.png)
318+
319+
* See also [stackoverflow - How to colorize diff on the command line?](https://stackoverflow.com/questions/8800578/how-to-colorize-diff-on-the-command-line) for other options
307320
308321
<br>
309322
310323
**Further Reading**
311324
312325
* `man diff` and `info diff` for more options and detailed documentation
313-
* [GNU diffutils manual](https://www.gnu.org/software/diffutils/manual/diffutils.html) for a better documentation than `man/info` versions
314-
* `diff3`, `vimdiff/gvimdiff` and `patch` commands
326+
* [GNU diffutils manual](https://www.gnu.org/software/diffutils/manual/diffutils.html) for a better documentation
327+
* `man -k diff` to get list of all commands related to `diff`
315328
* [diff Q&A on unix stackexchange](https://unix.stackexchange.com/questions/tagged/diff?sort=votes&pageSize=15)
316-
* [GUI diff and merge tools](http://askubuntu.com/questions/2946/what-are-some-good-gui-diff-and-merge-applications-available-for-ubuntu)
329+
* [unix.stackexchange - GUI diff and merge tools](https://unix.stackexchange.com/questions/4573/which-gui-diff-viewer-would-you-recommend-with-copy-to-left-right-functionality)
317330
* [unix.stackexchange - Understanding diff output](https://unix.stackexchange.com/questions/81998/understanding-of-diff-output)
318331
* [stackoverflow - Using output of diff to create patch](https://stackoverflow.com/questions/437219/using-the-output-of-diff-to-create-the-patch)
319332

0 commit comments

Comments
 (0)