Difference of 2 files

Syntax:  diff file2 file | grep '^>' | sed 's/^>\ //'


[prabhucloudxlab@cxln4 ~]$ diff /home/prabhucloudxlab/prabhu/input.txt /home/prabhucloudxlab/prabhu/input2.txt

1,4c1,4
< Hai this is hari
< Hai this is hari
< Hai this is hari
< Hai this is hari
---
> Hai this is prabhu
> Hai this is manyam
> Hai this is prabhu
> Hai this is taraka


Note: 
“4c1” means making a change in the fourth line of the first file to match line number 1 of the second file as both lines are slightly different.



[prabhucloudxlab@cxln4 ~]$ diff /home/prabhucloudxlab/prabhu/input.txt /home/prabhucloudxlab/prabhu/input2.txt | grep '^>'

> Hai this is prabhu
> Hai this is manyam
> Hai this is prabhu
> Hai this is taraka


Note: 
Grep is a Linux / Unix command-line tool used to search for a string of characters in a specified file



[prabhucloudxlab@cxln4 ~]$ diff /home/prabhucloudxlab/prabhu/input.txt /home/prabhucloudxlab/prabhu/input2.txt | grep '^>' | sed 's/^>\ //'

Hai this is prabhu
Hai this is manyam
Hai this is prabhu
Hai this is taraka


Note: 
SED command in UNIX stands for stream editor and it can perform lots of functions on file like searching, find and replace, insertion or deletion.



[prabhucloudxlab@cxln4 ~]$ diff  -u /home/prabhucloudxlab/prabhu/input.txt /home/prabhucloudxlab/prabhu/input2.txt


--- /home/prabhucloudxlab/prabhu/input.txt       2022-07-12 06:40:33.461219974 +0000
+++ /home/prabhucloudxlab/prabhu/input2.txt      2022-07-12 06:53:26.551290230 +0000
@@ -1,7 +1,7 @@
-Hai this is hari
-Hai this is hari
-Hai this is hari
-Hai this is hari
+Hai this is prabhu
+Hai this is manyam
+Hai this is prabhu
+Hai this is taraka
 I am looking for an ETL / Hadoop / Big Data /DWH Testing profile job..
 Please let me know if you have any openings regarding ETL / Hadoop / Big Data / DWH Tester.