Hi Gurus,
I have been trying to get the correct code but no avail.
Hope somebody can shed some lights on me.
My purpose is to list the files that exist in new.txt that are not in old.txt.
new.txt and old.txt are directory listing in 2 servers.
Thanks.
Here are my code :
awk '
BEGIN{while((getline < "old.txt") > 0) ref[$9]=$5;}
(ref[$9] !~$7){print $7} ' new.txt > results.txt
old.txt
-rw-r--r-- 1 root root 927 Aug 24 08:14 P1795922.ALT
-rw-r--r-- 1 root root 405 Aug 24 08:16 P2276720.ALT
-rw-r--r-- 1 root root 183 Aug 24 08:18 WE625408.ALT
-rw-r--r-- 1 root root 183 Aug 24 08:19 WE696622.ALT
-rw-r--r-- 1 root root 2721 Dec 5 08:44 451012.ALT
new.txt
-rw-r--r-- 1 2721 Dec 6 2005 451011.ALT
-rw-r--r-- 1 2721 Dec 6 2005 451012.ALT
-rw-r--r-- 1 2721 Dec 6 2005 451013.ALT
-rw-r--r-- 1 2721 Dec 6 2005 451014.ALT
-rw-r--r-- 1 2721 Dec 6 2005 451015.ALT
-rw-r--r-- 1 2721 Dec 6 2005 451016.ALT
I have been trying to get the correct code but no avail.
Hope somebody can shed some lights on me.
My purpose is to list the files that exist in new.txt that are not in old.txt.
new.txt and old.txt are directory listing in 2 servers.
Thanks.
Here are my code :
awk '
BEGIN{while((getline < "old.txt") > 0) ref[$9]=$5;}
(ref[$9] !~$7){print $7} ' new.txt > results.txt
old.txt
-rw-r--r-- 1 root root 927 Aug 24 08:14 P1795922.ALT
-rw-r--r-- 1 root root 405 Aug 24 08:16 P2276720.ALT
-rw-r--r-- 1 root root 183 Aug 24 08:18 WE625408.ALT
-rw-r--r-- 1 root root 183 Aug 24 08:19 WE696622.ALT
-rw-r--r-- 1 root root 2721 Dec 5 08:44 451012.ALT
new.txt
-rw-r--r-- 1 2721 Dec 6 2005 451011.ALT
-rw-r--r-- 1 2721 Dec 6 2005 451012.ALT
-rw-r--r-- 1 2721 Dec 6 2005 451013.ALT
-rw-r--r-- 1 2721 Dec 6 2005 451014.ALT
-rw-r--r-- 1 2721 Dec 6 2005 451015.ALT
-rw-r--r-- 1 2721 Dec 6 2005 451016.ALT