Gawk partial match
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
My gawk script isn't matching all potential results, it's only matching one of them..
Example -
script:
gawk -F: "FNR==NRa[$2]=$1;next $1 in aprint a[$1] FS $2" username.email.txt email.phone.txt > username.phone.txt
email.phone.txt - contains:
email@email.com:phoneexample
username.email.txt - contains:
user1:email@email.com
user131:email@email.com
EXPECTED OUTPUT - should be:
user1:phoneexample
user131:phoneexample
instead it will only match 1 of the lines containing " email@email.com "
outputting -
user131:email@email.com
awk cygwin gawk
add a comment |Â
up vote
1
down vote
favorite
My gawk script isn't matching all potential results, it's only matching one of them..
Example -
script:
gawk -F: "FNR==NRa[$2]=$1;next $1 in aprint a[$1] FS $2" username.email.txt email.phone.txt > username.phone.txt
email.phone.txt - contains:
email@email.com:phoneexample
username.email.txt - contains:
user1:email@email.com
user131:email@email.com
EXPECTED OUTPUT - should be:
user1:phoneexample
user131:phoneexample
instead it will only match 1 of the lines containing " email@email.com "
outputting -
user131:email@email.com
awk cygwin gawk
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
My gawk script isn't matching all potential results, it's only matching one of them..
Example -
script:
gawk -F: "FNR==NRa[$2]=$1;next $1 in aprint a[$1] FS $2" username.email.txt email.phone.txt > username.phone.txt
email.phone.txt - contains:
email@email.com:phoneexample
username.email.txt - contains:
user1:email@email.com
user131:email@email.com
EXPECTED OUTPUT - should be:
user1:phoneexample
user131:phoneexample
instead it will only match 1 of the lines containing " email@email.com "
outputting -
user131:email@email.com
awk cygwin gawk
My gawk script isn't matching all potential results, it's only matching one of them..
Example -
script:
gawk -F: "FNR==NRa[$2]=$1;next $1 in aprint a[$1] FS $2" username.email.txt email.phone.txt > username.phone.txt
email.phone.txt - contains:
email@email.com:phoneexample
username.email.txt - contains:
user1:email@email.com
user131:email@email.com
EXPECTED OUTPUT - should be:
user1:phoneexample
user131:phoneexample
instead it will only match 1 of the lines containing " email@email.com "
outputting -
user131:email@email.com
awk cygwin gawk
awk cygwin gawk
edited Aug 26 at 21:14
Jeff Schaller
32.7k849110
32.7k849110
asked Aug 26 at 20:12
questionaires
232
232
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
You might be better off when reversing files and fields:
awk -F: 'FNR==NRa[$1]=$2;next $2 in aprint $1 FS a[$2]' email.phone.txt username.email.txt
user1:phoneexample
user131:phoneexample
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
You might be better off when reversing files and fields:
awk -F: 'FNR==NRa[$1]=$2;next $2 in aprint $1 FS a[$2]' email.phone.txt username.email.txt
user1:phoneexample
user131:phoneexample
add a comment |Â
up vote
1
down vote
accepted
You might be better off when reversing files and fields:
awk -F: 'FNR==NRa[$1]=$2;next $2 in aprint $1 FS a[$2]' email.phone.txt username.email.txt
user1:phoneexample
user131:phoneexample
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
You might be better off when reversing files and fields:
awk -F: 'FNR==NRa[$1]=$2;next $2 in aprint $1 FS a[$2]' email.phone.txt username.email.txt
user1:phoneexample
user131:phoneexample
You might be better off when reversing files and fields:
awk -F: 'FNR==NRa[$1]=$2;next $2 in aprint $1 FS a[$2]' email.phone.txt username.email.txt
user1:phoneexample
user131:phoneexample
answered Aug 26 at 20:28
RudiC
1,2398
1,2398
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f464958%2fgawk-partial-match%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password