I have 2 files to comapre ,in file a sible column it is numbers,in file b2 numbers and other values with coma separated.
i want compare numbers in file a with file b,and the out put put should be in C with numbers in both file a and b along with other columns of file b.
i used folowing scripts
for line in `cat gprs2.txt`
do
more gprs_calls2.txt |grep $line >> NEW2.txt
done
exit
but it is not giving correct out put.and also this scrpits is not sppedy
I have Tried .could u plz help..
out 'NR==FNR{_[$1];next}$1 in _' gprs2.txt gprs_calls2.txt
scripts by rplacing the respective filenames ,the out put does not have any data
the actual file lokks like this
Source file
7055000601
7055000633
7055000965
7055001182
7055001352
7055001468
Dest file to be compared(Source file no should be compared with dest file,the out should be the no of desti ,which exists in source,along with othere columns of desti corresponds the number
7055000601,35250401506992,621505200525591
7055000633,35574402566128,621505200525623
7055000965,35966800701265,621505200525952
7055001182,35844301188404,621505200526156
7055001352,35350902954276,621505200526325
7055001468,35195101170824,621505200526441
7055001490,35501600003290,621505200526463
7055003310,35487502010707,621505200528256
7055006309,04857558566586,621505200531213
The field separator is missing from radoulov's script.
awk -F, 'NR==FNR{_[$1];next}$1 in _' gprs2.txt gprs_calls2.txt
Your description of the output you require is not understandable to me. This will print the lines in gprs_calls2.txt whose first field matches a value in (the first field of) gprs2.txt.
The out put is comming but the problem is ,,for the msisdn in file1,their may be chances that 2 lines can match because the column no 2 and 3 of file2 is diffrent.
i required the no which is having duplicate entry should be redrected to another file,and the no which is not duplicate need to redirected another file.
how can i achiev plz help