When I was updating one file, I have taken backup as filename_old.
After updating (adding and removing line) the current file, I thought let me see what are all the updates I have done to the current file. Then I thought, there is a concept call patch file.
Then I decided to create the patch file.
I have searched and surprised that "diff" command is able to do that.
Files: 1.txt (Original File), 2.txt (Modified File), diff.patch (Patch File)
Syntax: diff -Naur Original_File Modified_File > Patch_File
In terminal window, execute the following command
$ diff -Naur 1.txt 2.txt >> diff.patch
--- 1.txt 2012-06-01 23:25:02.713727335 +0530
+++ 2.txt 2012-06-01 23:25:09.833727317 +0530
@@ -1,7 +1,6 @@
Syntax: patch -u Original_File Patch_File
$ patch -u 1.txt diff.patch
Now, we have successfully applied the patch to the old (Original) file.
Please send your feedback to email@example.com or write comments