Really appreciate your time in writing the awk script.
But each of these files have 500K records.
But I have managed to write a perl script for the diff file. i.e.
The above code works perfectly for generating the diff file i.e. depending upon the primary keys (here taken 2) the outfile contains the records that exists in file1 but not in file2 and the records that exists in file2 but not in file1.
Now,
I need to compare the whole record(line) if the primary keys in file1 matches with the primary keys in file2. If both the lines are equal then discard else write to the outfile.
Could someone please help me out in order to the above step.
Thanks a lot for providing the awk script.
As you said the awk looks simpler and shorter.
I have ran the two awk scripts that you have provided to me for the two different files and have generated the two same.txt and same1.txt files.
File1.diff --> Records that exists in File1 but not in File2
same.txt --> Records that exists in both the files
File2.diff --> Records that exists in File2 but not in File1
same1.txt --> Records that exists in both the files'
Here,
The file size of the same.txt and same1.txt is different.
--> 506108009 Jun 15 01:50 same.txt
--> 505878904 Jun 15 01:52 same1.txt
So, is there anyway that we can capture the records if the Primary Keys ($38 and $82) of both the files matches but the data in the other columns is not the same.
To solve the above issue, I thought once we have the files same.txt and same1.txt we should compare the number of characters in the a line in File1 with number of characters in a line in file2 , if there is a change then write to a file else discard (do nothing or leave it)
Could you please share any ideas to solve the above issue. It would be really grateful.
Hello all,
I have 2 text files.
For example:
File1.txt contains data
A
B
C
D
****NEXT****
X
Y
Z
****NEXT****
L
M
N
and File2.txt contains data (13 Replies)
I need to take 2 input files and create 1 output based on matches from each file. I am looking to match field #1 in both files (Userid) and create an output file that will be a combination of fields from
both file1 and file2 if there are any differences in the fields 2,3,4,5,or 6.
Below is an... (5 Replies)
Hi
I am writing a perl script which checks for the specific column values from a file and writes to the OUT file.
So the feed file has a header information and footer information.
I header information isaround107 lines i.e.
Starts with
START-OF-FILE
.......
so on ....
... (11 Replies)
cat file1.txt
field1 "user1":
field2:"data-cde"
field3:"data-pqr"
field4:"data-mno"
field1 "user1":
field2:"data-dcb"
field3:"data-mxz"
field4:"data-zul"
field1 "user2":
field2:"data-cqz"
field3:"data-xoq"
field4:"data-pos"
Now i need to have the date like below.
i have just... (7 Replies)
Hi Guys,
I have two input files and I want to combine them and get the unique values and differences and put them into one file. See below desired output file.
Inputfile1:
1111111
2222222
3333333
7860068
7860069
7860071
7860072
Inputfile2:
4444444 (4 Replies)
Hi,
I have several text files. One main file contains the detail data, other have some information to extract data from the main file, and some are empty files. Examples are shown below:
The main file look like:
MainFile.txt
>Header1
data1...data1...
>Header2
data2...data2...
...
...... (2 Replies)
Hi,
I have two text files. Need to create a third text file extracting specific data from first two existing files..
Text File 1: Format contains:
SQL*Loader: Release 10.2.0.1.0 - Production on Wed Aug 4 21:06:34 2010
some text ............so on...and somwhere text like:
Record 1:... (1 Reply)
ehe may i know what are the difference between Unix & Linux, and what are the advantages of having Unix as well as disadvantages of having Unix or if u dun mind i am dumb do pls tell me what are the advantages as well as the disadvantages of having linux as well. thanks (1 Reply)