diff ja patch

Loome failid pakk1.txt sisuga:
rida1
rida2

ja faili pakk2.txt sisuga:
rida1
rida2
rida3


$ diff -u pakk1.txt pakk2.txt > pakk.patch

pakk.patch sisu peak olema:

--- pakk1.txt 2009-01-13 08:35:39.000000000 +0200
+++ pakk2.txt 2009-01-13 08:36:02.000000000 +0200
@@ -1,2 +1,3 @@
rida1
-rida2
\ No newline at end of file
+rida2
+rida3

patchime pakk1.txt faili:

[08:39:24 margusja@Irack:~ ] $ patch pakk1.txt < pakk.patch patching file pakk1.txt

Faili pakk1.txt sisu peaks olema:
rida1
rida2
rida3

Leave a Reply