I have file1 and file2
I lookup field3 from file2 in field1 of file1 and if there is a match, output field 2,3,5 from file2.
I now want to add field2 of file1 in the output.
I suspect what I have to do is read the entire line of file1 into a 2 dim array? pls help.
Hello, guys!
I want to find difference between two file according $1. I using the following code, but get wrong results.
Code:
awk -F, 'NR==FNR{A[$1]=$0; next} $1!=A[$1]' file1 file2
I can using the following code get same record between files.
Hi all !
I have 2 files:
file1:
Code:
1|AAA|123456
2|BBB|098765432
...
file2:
Code:
-|klk|AAA|$123.00|Qty.2|US
-|opi|EEE|$23.00|Qty.4|US
...
Output:
Code:
1|AAA|-|klk|AAA|$123.00|Qty.2|US
I would need to search the 3rd field of file2 for the patterns contained in the 2nd field of file1.
And then, for the matching lines, return fields 1 and 2 from file1 followed by t
Hello experts,
I have this problem, I need to match values based on two files, this is what I have:
file1
Code:
1.1
1.2
1.3
5.5
1.4
1.5
1.6
file2
Code:
1 a
2 B
3 C
4 D
5 z
6 F
7 G
8 H
9 I
10 J
11 K
12 L
13 M
14 N
15 O
16 P
17 Q
18 R
19 S
20 T
and the desired output is:
Code:
a
a
a
z
a
a
a
I'm using this code:
Code:
awk 'NR==FNR{a[int($1+.5)];next} $1 in a {print $2}' fil
Hi Freinds,
i have a file1 as below
file1
Code:
1|ndmf|fdd|d3484|34874
2|jdehf|wru7|478|w489
3|dfkj|wej|484|49894
file2 contains lakhs of records and not in sorted order
i want to retrive only the records from file2 by searcing the first field of file 1
i used
Code:
grep ^1 file2 >out.txt
grep ^2 file2 >>out.txt
grep ^3 file2>>out.txt
this i need to do 3 time
Hi Everyone!
I would like ask if there's a better way I can delete multiple lines in a file1 by collecting all criteria from file2.
file1:
a
b
c
d
e
f
file2:
a
e
f
The expected value will be:
b
c
d
The code below seems to work however if is taking much time when dealing with huge records.
Code:
cat file1
1 a b c
2 d e f
3 a f r
Code:
cat file2
a c e
output should be
Code:
1
3
means:
if field 1 of file2 matches filed 2 of file1 then print field 1 of file1
I know that it can be done using awk NR=FNR.
But not able to acheive it.
Thanks in advance.
Hello,
I have two pipe-delimited data files.
I need to use a bash script to remove duplicate files from a download list, but I cannot use uniq because the urls are different.
I need to go from this:
Code:
http://***/fae78fe/file1.wmv
http://***/39du7si/file1.wmv
http://***/d8el2hd/file2.wmv
http://***/h893js3/file2.wmv
to this:
Code:
http:/***/fae78fe/file1.wmv
http://***/d8el2hd/file2.wmv
How would you solve this?