Comparing two text files
Clash Royale CLAN TAG#URR8PPP
up vote
-4
down vote
favorite
I have a text file like this.
2XKJ;2XKK; B0V9T6
2XKJ;2XKK; B0VP98
3TSG; D3X610
and i have another file having PDB IDs.
2XKJ
2XKJ
2XKJ
2XKK
I want a output like this
2XKJ B0V9T6 B0VP98
2XKJ B0V9T6 B0VP98
2XKJ B0V9T6 B0VP98
2XKK B0V9T6 B0VP98
how to get this output using perl
, awk
or linux
linux awk perl
add a comment |Â
up vote
-4
down vote
favorite
I have a text file like this.
2XKJ;2XKK; B0V9T6
2XKJ;2XKK; B0VP98
3TSG; D3X610
and i have another file having PDB IDs.
2XKJ
2XKJ
2XKJ
2XKK
I want a output like this
2XKJ B0V9T6 B0VP98
2XKJ B0V9T6 B0VP98
2XKJ B0V9T6 B0VP98
2XKK B0V9T6 B0VP98
how to get this output using perl
, awk
or linux
linux awk perl
1
whyB0VP98
should be skipped?
â RomanPerekhrest
Dec 6 '17 at 9:39
Ohh so sorry ..the output should be like ..2XKJ B0V9T6 B0VP98 2XKJ B0V9T6 B0VP98 2XKJ B0V9T6 B0VP98 2XKK B0V9T6 B0VP98
â Tina Sharma
Dec 6 '17 at 10:03
add a comment |Â
up vote
-4
down vote
favorite
up vote
-4
down vote
favorite
I have a text file like this.
2XKJ;2XKK; B0V9T6
2XKJ;2XKK; B0VP98
3TSG; D3X610
and i have another file having PDB IDs.
2XKJ
2XKJ
2XKJ
2XKK
I want a output like this
2XKJ B0V9T6 B0VP98
2XKJ B0V9T6 B0VP98
2XKJ B0V9T6 B0VP98
2XKK B0V9T6 B0VP98
how to get this output using perl
, awk
or linux
linux awk perl
I have a text file like this.
2XKJ;2XKK; B0V9T6
2XKJ;2XKK; B0VP98
3TSG; D3X610
and i have another file having PDB IDs.
2XKJ
2XKJ
2XKJ
2XKK
I want a output like this
2XKJ B0V9T6 B0VP98
2XKJ B0V9T6 B0VP98
2XKJ B0V9T6 B0VP98
2XKK B0V9T6 B0VP98
how to get this output using perl
, awk
or linux
linux awk perl
edited Dec 6 '17 at 10:10
Stéphane Chazelas
282k53520854
282k53520854
asked Dec 6 '17 at 9:31
Tina Sharma
271
271
1
whyB0VP98
should be skipped?
â RomanPerekhrest
Dec 6 '17 at 9:39
Ohh so sorry ..the output should be like ..2XKJ B0V9T6 B0VP98 2XKJ B0V9T6 B0VP98 2XKJ B0V9T6 B0VP98 2XKK B0V9T6 B0VP98
â Tina Sharma
Dec 6 '17 at 10:03
add a comment |Â
1
whyB0VP98
should be skipped?
â RomanPerekhrest
Dec 6 '17 at 9:39
Ohh so sorry ..the output should be like ..2XKJ B0V9T6 B0VP98 2XKJ B0V9T6 B0VP98 2XKJ B0V9T6 B0VP98 2XKK B0V9T6 B0VP98
â Tina Sharma
Dec 6 '17 at 10:03
1
1
why
B0VP98
should be skipped?â RomanPerekhrest
Dec 6 '17 at 9:39
why
B0VP98
should be skipped?â RomanPerekhrest
Dec 6 '17 at 9:39
Ohh so sorry ..the output should be like ..2XKJ B0V9T6 B0VP98 2XKJ B0V9T6 B0VP98 2XKJ B0V9T6 B0VP98 2XKK B0V9T6 B0VP98
â Tina Sharma
Dec 6 '17 at 10:03
Ohh so sorry ..the output should be like ..2XKJ B0V9T6 B0VP98 2XKJ B0V9T6 B0VP98 2XKJ B0V9T6 B0VP98 2XKK B0V9T6 B0VP98
â Tina Sharma
Dec 6 '17 at 10:03
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
With awk
:
awk -F ';[[:blank:]]*' '
!file1_done for (i = 1; i < NF; i++) val[$i] = val[$i] " " $NF; next
print $1 val[$1]' file1 file1_done=1 file2
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
With awk
:
awk -F ';[[:blank:]]*' '
!file1_done for (i = 1; i < NF; i++) val[$i] = val[$i] " " $NF; next
print $1 val[$1]' file1 file1_done=1 file2
add a comment |Â
up vote
1
down vote
With awk
:
awk -F ';[[:blank:]]*' '
!file1_done for (i = 1; i < NF; i++) val[$i] = val[$i] " " $NF; next
print $1 val[$1]' file1 file1_done=1 file2
add a comment |Â
up vote
1
down vote
up vote
1
down vote
With awk
:
awk -F ';[[:blank:]]*' '
!file1_done for (i = 1; i < NF; i++) val[$i] = val[$i] " " $NF; next
print $1 val[$1]' file1 file1_done=1 file2
With awk
:
awk -F ';[[:blank:]]*' '
!file1_done for (i = 1; i < NF; i++) val[$i] = val[$i] " " $NF; next
print $1 val[$1]' file1 file1_done=1 file2
answered Dec 6 '17 at 10:08
Stéphane Chazelas
282k53520854
282k53520854
add a comment |Â
add a comment |Â
Â
draft saved
draft discarded
Â
draft saved
draft discarded
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%2f409147%2fcomparing-two-text-files%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
1
why
B0VP98
should be skipped?â RomanPerekhrest
Dec 6 '17 at 9:39
Ohh so sorry ..the output should be like ..2XKJ B0V9T6 B0VP98 2XKJ B0V9T6 B0VP98 2XKJ B0V9T6 B0VP98 2XKK B0V9T6 B0VP98
â Tina Sharma
Dec 6 '17 at 10:03