LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   file comparions using awk (https://www.linuxquestions.org/questions/linux-newbie-8/file-comparions-using-awk-644464/)

jkeertir 05-24-2008 05:20 AM

file comparions using awk
 
Dear ALL,

I have absolutely no idea of how to write awk program to compare two differet files using awk.


suppose my first file is

a:
-rw-r--r-- 1 root root 5 May 21 09:17 n
a/aa:
-rw-r--r-- 1 root root 50 May 19 09:17 n1
-rw-r--r-- 1 root root 56 May 20 09:17 n2
-rw-r--r-- 1 root root 25 May 22 09:17 n3

and my second file is

a:
-rw-r--r-- 1 root root 5 May 21 09:17 n
a/aa:
-rw-r--r-- 1 root root 550 May 19 09:17 n1
-rw-r--r-- 1 root root 56 May 20 09:17 n2
-rw-r--r-- 1 root root 25 May 22 09:17 nnn
-rw-r--r-- 1 root root 25 May 22 09:17 n3

i want to compare these two files and if field 5 of second file is greter than feild 5 of first file ,for ex "n1" in this case ,i want to print output as a/aa/n1 in a file.

Please help me to solve this issue,or atleast an idea of how can i solve this issue.

With regards,
Keerti

Jim44 05-24-2008 06:31 AM

Check out this article. I think you'll find the answer here if you look carefully.

http://www.ibm.com/developerworks/library/l-awk1.html


All times are GMT -5. The time now is 03:58 PM.