LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-24-2008, 06:20 AM   #1
jkeertir
Member
 
Registered: Mar 2008
Posts: 70

Rep: Reputation: 15
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
 
Old 05-24-2008, 07:31 AM   #2
Jim44
Member
 
Registered: Feb 2006
Location: Atlanta, Georgia, USA
Distribution: Mint, Ubuntu, Centos
Posts: 52

Rep: Reputation: 15
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
awk searching a string from a file within another file changcheh Linux - Software 7 12-29-2006 10:18 AM
awk: fatal:cannot open file for reading (no such file or Directory) in Linux sangati vishwanath Linux - Software 4 07-06-2005 01:59 AM
awk and change file content Ayman.mashal Programming 4 06-02-2005 07:03 AM
Formating a file with awk tifu Programming 5 03-17-2005 12:35 AM
editing a file using awk pantera Programming 1 05-14-2004 09:40 AM


All times are GMT -5. The time now is 05:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration