Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 05-24-2008, 06:20 AM   #1
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

-rw-r--r-- 1 root root 5 May 21 09:17 n
-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

-rw-r--r-- 1 root root 5 May 21 09:17 n
-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,
Old 05-24-2008, 07:31 AM   #2
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.


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 > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:40 PM.

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