entrylevel
Technical User
I read some of the posts here, but still could not come up a very good and smart logic for my case using awk
goal is to find difference between two files (the added lines, the removed lines and the changed lines) (first column are unique entries while 2nd column may contain duplicate entries)
file1
1.1 bj
2.2 hk
3.3 sj
4.4 tw
5.5 ch
6.6 kr
7.7 sg
10.10 sj
11.11 fr
file2
2.2 hk
3.3 uk
4.4 tw
5.5 sd
7.7 sg
8.8 in
9.9 ca
10.10 sj
11.11 fr
desire output would be ( append to a file )
following lines have been removed
1.1 bj
6.6 kr
following lines have been added
8.8 in
9.9 ca
following lines have been changed
3.3 from sj to uk
5.5 from ch to sd
I used diff a script to compare and get those info, only easy with removed and added items not quite smart with changed items, want to get some idea how to use awk to accomplish it. please inspire. Thanks.
Regards!
goal is to find difference between two files (the added lines, the removed lines and the changed lines) (first column are unique entries while 2nd column may contain duplicate entries)
file1
1.1 bj
2.2 hk
3.3 sj
4.4 tw
5.5 ch
6.6 kr
7.7 sg
10.10 sj
11.11 fr
file2
2.2 hk
3.3 uk
4.4 tw
5.5 sd
7.7 sg
8.8 in
9.9 ca
10.10 sj
11.11 fr
desire output would be ( append to a file )
following lines have been removed
1.1 bj
6.6 kr
following lines have been added
8.8 in
9.9 ca
following lines have been changed
3.3 from sj to uk
5.5 from ch to sd
I used diff a script to compare and get those info, only easy with removed and added items not quite smart with changed items, want to get some idea how to use awk to accomplish it. please inspire. Thanks.
Regards!