Thanks so much for the quick reply. I tried your command and got he results as below.
file1.txt
file2.txt
Actual Output :
Expected Output:
Here if i use frep -v -f i am getting the output where i have difference . The expected output should not contain the difference lines it should cntain only the extra lines
Thanks in advance. please help.
Last edited by Scrutinizer; 07-23-2012 at 05:38 AM..
Reason: code tags
@OP: It seems to me that you are looking for a solution where not all columns are significant, but then you would need to tell us which columns determine whether records are "equal" .
This User Gave Thanks to Scrutinizer For This Post:
@Scrutinizer, sorry i think i have confused you. let me explain in detail .
Expected Output:
I want to compare 2 files let say file1.txt( record count 4) and file 2.txt ( record 3 count) .
file1 :
file2.txt
i want to compare 2 files line by line. the Expected output should contain the lines which are present in file1.txt but not in file2.txt. if i use command comm -23
I got the above output because there is a difference in line 2 and one more line is missing in file1.txt.
But i need to get only the |lok|ter|3|6 , where this line is present in file1.txt but not in file2.txt.
Hope this helps you . please look into it.. I am very new to Unix
Last edited by Scrutinizer; 07-23-2012 at 06:20 AM..
Reason: code tags
The jun|out records are not the same, so that record gets printed. Yet you do not want it to get printed, so you need to tell us on which basis they should be considered equal.. Is it because of column 1, 2, 3? Or a combination?
Hi,
We have created a script that's checks the latency of IIDR subscription by fetching details from a config file (that contains subscription details) and running the CHCCLP command. The out put is then concatenated in a csv file. Once all subscription details are saved the script send a mail... (7 Replies)
Hi,
I am using Sun Solaris - SunOS. I have two fixed width files shown below. I am trying to find the changes in the records in the Newfile.txt for the records where the key column matches. The first column is a key column (example: A123).
If there are any new or deletion of records in the... (4 Replies)
hi.. I want to compare records present in 1 file with those in 3 other files and print those records of file 1 which are not present in any of the files. for eg -
file1 file2 file3 file4
1 1 5 7
2 2 6 9
3
4
5
6
7
8
9
... (3 Replies)
hi.. i am using solaris system and ksh and using nawk to get records of file1 not in file2(not line by line comparison). code i am using is nawk 'NR==FNR{a++} !a {print"line:" FNR"->" $0} ' file2 file1
same command with awk runs perfectly on darwin kernel(mac) but in solaris it does line by... (2 Replies)
Hi ,
My requirement is to Compare 2 files having different number of columns and records and get the ouptut containing all the non-matching records from File A(with all column values ) .Example data below :
File A contains following :
Aishvarya |1234... (4 Replies)
I have 2 zip files which have about 20 million records in each file. file 2 will have additional records than file 1. I want to compare the records in both the files and capture the new records from file 2 into another file file3. Please help me with a command/script which provides me the desired... (8 Replies)
I am not an expert in awk, SED, etc... but I really hope there is a way to do this, because I don't want to have to right a program. I am using C shell.
FILE 1 FILE 2
H0000000 H0000000
MA1 MA1
CA1DDDDDD CA1AAAAAA
MA2 ... (2 Replies)
Hi All,
I have two files say file1 and file2.
I want to check the number of records in file1 and if its atleast 2 (i.e., 2 or greater than 2 ) then I have to check records in file2 .If records in file2 is atleast 1 (i.e. if its not empty ) i have to set some conditions .
Could you pls... (3 Replies)
I have two files - file1 and file2. Now I want records in file2 those are not exist in file1. How to grep this ?
eg:
file1
08941
08944
08945
08946
08947
file2
08942 08944 5
08942 08945 5
08942 08946 4
08942 08947 6
08942 08952 4
08942 08963 5
08942 ... (3 Replies)
I'm trying to compare the first column values in two different files that use a numerical value as the key and output the more meaningful value found in the second column of file1 in front of the matching line(s) in file2. My problem is that file2 has multiple records. For example given:
FILE1... (4 Replies)