UNIX/コマンド/テキスト処理/diff


Table of Contents
% diff [file1] [file2]

% [command] | diff - [file]
% diff [dir1] [dir2]

% diff -r [dir1] [dir2]
% /usr/local/bin/diff -u [file1] [file2] > [patch_file]

1c1
< test
---
> ttest
--- [file1]        Tue Oct  7 03:06:46 2003
+++ [file2]        Tue Oct  7 03:06:53 2003
@@ -1 +1 @@
-test
+ttest

% patch < [patch_file]

% diff -ur Project/ Project2/ > patch.diff
--- [Project/file]        Tue Oct  7 03:06:46 2003
+++ [Project2/file]        Tue Oct  7 03:06:53 2003
% ls
Project/
% patch -p0 < patch.diff

% diff -u orig/Project/ modified/Project/ > patch.diff
--- [orig/Project/file]        Tue Oct  7 03:06:46 2003
+++ [modified/Project/file]        Tue Oct  7 03:06:53 2003
% ls
orig/
% patch -p0 < patch.diff

% ls
Project/
% patch -p1 < patch.diff


xrea