file 2
My task is to loop through the file1 take the first field say (11346925) grep the lines containing 11346925 from both the files. compare both data's are same if not then write field 1 to a file.if field 1 from file1 not present in file 2 then also need to write field 1.
i tried with while loop but its taking much time when the file has some 16000 lines.
I hope i could do with awk.Please help me to achieve this faster using awk.
Hi thanks for the quick reply.
when i used the code it just print all the lines i.e all the field 1.
one thing i missed out in the previous post is both the files may not be in a same order like fileld
may not be in the file2 sometimes or may be the last record in file 2 or wherever it might be.and just wanted to know about the previous awk code.
kindly help me on this
field 1 is the desired output under the below conditions
data of field 1 from file 1 and file 2 should be same.i.e two lines from file 1 for field 1 and 2 lines from file 2 should be same. ( because field 1 from both the files may or may not conatins 2 lines with different data except field 1 )
ex:
file 1 129543110|2009-09-11|9999-12-31|130|0 129543110|0|2009-07-23|2999-12-31|120|0
file 2 129543110|0|2009-09-11|9999-12-31|130|0 129543110|0|2009-07-23|2999-12-31|120|0
the above case has a perfect match in two files no need to write anything to a file.
file 1:
file 2:
inthis case it is a mismatch then need to write 129543112 to a file.
Hi Guys,
I am having two requirement in one of my scripts. please help out to find a fast solution using AWK (since there is lot of data to be processed)
1) First snippet -
File1 has two columns and file2 has three columns
If any value of column 1 of file1 matches with column 1... (4 Replies)
my files are as follows
fileA sepearated by tab /t
00 lieferungen
00 attractiop
01 done
02 forness
03 rasp
04 alwaysisng
04 funny
05 done1
fileB
funnymou120112
funnymou234470
mou3raspnhdhv
rddfgmoudone1438748
so all those record which are greater than 3 and which are not... (6 Replies)
Hello,
I couldn't find anything on the Forum that would help me to solve this problem. Could any body help me process below data using awk?
I have got two files:
file1:
Worker1: Thomas
Position: Manager
Department: Sales
Salary: $5,000
Worker2: Jason
Position: ... (5 Replies)
Hi all,
I would like to compare a column in one file to a column in another file and when there is a match it prints the first column and the corresponding second column. Example
File1
ABA
ABC
ABE
ABF
File 2
ABA 123
ABB 124
ABD 125
ABC 126
So what I would like printed to a... (6 Replies)
Hello all,
Probably a very simple question, I am stuck with a small part of a code:
I am trying to do a comparison to get the maximum value of column 6 if columns 1, 4 and 5 of two or more rows match. Here is what I am doing:
awk -F'\t' '{if ($6 > a)a=$6}END{for (i in a) print i"\t"a}'
... (4 Replies)
I have two files which I would like to compare and then manipulate in a way.
File1:
pictures.txt 1.1 1.3
dance.txt 1.2 1.4
treehouse.txt 1.3 1.5
File2:
pictures.txt 1.5 ref2313 1.4 ref2345 1.3 ref5432 1.2 ref4244
dance.txt 1.6 ref2342 1.5 ref2352 1.4 ref0695 1.3 ref5738 1.2... (1 Reply)
- I am looking for different kind of awk solution which I don't think is mentioned before in these forums.
Number of rows in the file are fixed
Their are two columns in file1.txt
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
I am looking for 3... (1 Reply)
Hi,
I have two files file1 and file2 delimited by semicolon,
And I want to compare column 2 and column3 of file1 to column3 and column 4 in file2.
file1
--------
abc;cef;155.67;143_34;
def;fgh;146.55;123.3;
frg;hff;134.67;;
yyy;fgh;134.78;35_45;
file 2
---------
abc;cef;155.09;;... (12 Replies)