Replacing matching entries in one column of a file by another column from a different file The 2019 Stack Overflow Developer Survey Results Are InMerge two files: two lines, partial line, two lines, partial line, etcFind common elements in a given column from two files and output the column values from each filecompare multiple files(more than two) with two different columnsReplace column in one file with column from another using awk?Joining columns from files if they contain a match in another columnMerging two files, one column at a timeColumn matching in separate filesExtract row if both column values appear in a single column from a separate fileJoining entries based off of column using awk/joinCompare two files by first column. Keep rows if matchingRecursively find and replace contents of one file using a key from another file

Time travel alters history but people keep saying nothing's changed

Did Scotland spend $250,000 for the slogan "Welcome to Scotland"?

Is a "Democratic" Oligarchy-Style System Possible?

Return to UK after being refused entry years previously

Can a flute soloist sit?

Multiply Two Integer Polynomials

How to manage monthly salary

Geography at the pixel level

When should I buy a clipper card after flying to OAK?

For what reasons would an animal species NOT cross a *horizontal* land bridge?

Apparent duplicates between Haynes service instructions and MOT

How technical should a Scrum Master be to effectively remove impediments?

Falsification in Math vs Science

Resizing object distorts it (Illustrator CC 2018)

Delete all lines which don't have n characters before delimiter

How to deal with fear of taking dependencies

How to answer pointed "are you quitting" questioning when I don't want them to suspect

Is there any way to tell whether the shot is going to hit you or not?

Which Sci-Fi work first showed weapon of galactic-scale mass destruction?

Lightning Grid - Columns and Rows?

Aging parents with no investments

Did Section 31 appear in Star Trek: The Next Generation?

"as much details as you can remember"

If a Druid sees an animal’s corpse, can they wild shape into that animal?



Replacing matching entries in one column of a file by another column from a different file



The 2019 Stack Overflow Developer Survey Results Are InMerge two files: two lines, partial line, two lines, partial line, etcFind common elements in a given column from two files and output the column values from each filecompare multiple files(more than two) with two different columnsReplace column in one file with column from another using awk?Joining columns from files if they contain a match in another columnMerging two files, one column at a timeColumn matching in separate filesExtract row if both column values appear in a single column from a separate fileJoining entries based off of column using awk/joinCompare two files by first column. Keep rows if matchingRecursively find and replace contents of one file using a key from another file



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








7















I have two tab-separated files which look as follows:



file1:



NC_008146.1 WP_011558474.1 1155234 1156286 44173
NC_008146.1 WP_011558475.1 1156298 1156807 12
NC_008146.1 WP_011558476.1 1156804 1157820 -3
NC_008705.1 WP_011558474.1 1159543 1160595 42748
NC_008705.1 WP_011558475.1 1160607 1161116 12
NC_008705.1 WP_011558476.1 1161113 1162129 -3
NC_009077.1 WP_011559727.1 2481079 2481633 8
NC_009077.1 WP_011854835.1 1163068 1164120 42559
NC_009077.1 WP_011854836.1 1164127 1164636 7


file2:



NC_008146.1 GCF_000014165.1_ASM1416v1_protein.faa
NC_008705.1 GCF_000015405.1_ASM1540v1_protein.faa
NC_009077.1 GCF_000016005.1_ASM1600v1_protein.faa


I want to match column 1 of file1 to file2 and replace itself with the respective column 2 entry of file 2.
The output would look like this:



GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7









share|improve this question









New contributor




BhushanDhamale is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • It looks like you might also be interested in our sister site: Bioinformatics.

    – terdon
    Apr 5 at 12:54











  • Thank you for the link @terdon!

    – BhushanDhamale
    Apr 5 at 12:57

















7















I have two tab-separated files which look as follows:



file1:



NC_008146.1 WP_011558474.1 1155234 1156286 44173
NC_008146.1 WP_011558475.1 1156298 1156807 12
NC_008146.1 WP_011558476.1 1156804 1157820 -3
NC_008705.1 WP_011558474.1 1159543 1160595 42748
NC_008705.1 WP_011558475.1 1160607 1161116 12
NC_008705.1 WP_011558476.1 1161113 1162129 -3
NC_009077.1 WP_011559727.1 2481079 2481633 8
NC_009077.1 WP_011854835.1 1163068 1164120 42559
NC_009077.1 WP_011854836.1 1164127 1164636 7


file2:



NC_008146.1 GCF_000014165.1_ASM1416v1_protein.faa
NC_008705.1 GCF_000015405.1_ASM1540v1_protein.faa
NC_009077.1 GCF_000016005.1_ASM1600v1_protein.faa


I want to match column 1 of file1 to file2 and replace itself with the respective column 2 entry of file 2.
The output would look like this:



GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7









share|improve this question









New contributor




BhushanDhamale is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • It looks like you might also be interested in our sister site: Bioinformatics.

    – terdon
    Apr 5 at 12:54











  • Thank you for the link @terdon!

    – BhushanDhamale
    Apr 5 at 12:57













7












7








7








I have two tab-separated files which look as follows:



file1:



NC_008146.1 WP_011558474.1 1155234 1156286 44173
NC_008146.1 WP_011558475.1 1156298 1156807 12
NC_008146.1 WP_011558476.1 1156804 1157820 -3
NC_008705.1 WP_011558474.1 1159543 1160595 42748
NC_008705.1 WP_011558475.1 1160607 1161116 12
NC_008705.1 WP_011558476.1 1161113 1162129 -3
NC_009077.1 WP_011559727.1 2481079 2481633 8
NC_009077.1 WP_011854835.1 1163068 1164120 42559
NC_009077.1 WP_011854836.1 1164127 1164636 7


file2:



NC_008146.1 GCF_000014165.1_ASM1416v1_protein.faa
NC_008705.1 GCF_000015405.1_ASM1540v1_protein.faa
NC_009077.1 GCF_000016005.1_ASM1600v1_protein.faa


I want to match column 1 of file1 to file2 and replace itself with the respective column 2 entry of file 2.
The output would look like this:



GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7









share|improve this question









New contributor




BhushanDhamale is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I have two tab-separated files which look as follows:



file1:



NC_008146.1 WP_011558474.1 1155234 1156286 44173
NC_008146.1 WP_011558475.1 1156298 1156807 12
NC_008146.1 WP_011558476.1 1156804 1157820 -3
NC_008705.1 WP_011558474.1 1159543 1160595 42748
NC_008705.1 WP_011558475.1 1160607 1161116 12
NC_008705.1 WP_011558476.1 1161113 1162129 -3
NC_009077.1 WP_011559727.1 2481079 2481633 8
NC_009077.1 WP_011854835.1 1163068 1164120 42559
NC_009077.1 WP_011854836.1 1164127 1164636 7


file2:



NC_008146.1 GCF_000014165.1_ASM1416v1_protein.faa
NC_008705.1 GCF_000015405.1_ASM1540v1_protein.faa
NC_009077.1 GCF_000016005.1_ASM1600v1_protein.faa


I want to match column 1 of file1 to file2 and replace itself with the respective column 2 entry of file 2.
The output would look like this:



GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7






awk






share|improve this question









New contributor




BhushanDhamale is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




BhushanDhamale is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Apr 5 at 12:56









Rui F Ribeiro

42k1483142




42k1483142






New contributor




BhushanDhamale is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Apr 5 at 12:32









BhushanDhamaleBhushanDhamale

1623




1623




New contributor




BhushanDhamale is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





BhushanDhamale is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






BhushanDhamale is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • It looks like you might also be interested in our sister site: Bioinformatics.

    – terdon
    Apr 5 at 12:54











  • Thank you for the link @terdon!

    – BhushanDhamale
    Apr 5 at 12:57

















  • It looks like you might also be interested in our sister site: Bioinformatics.

    – terdon
    Apr 5 at 12:54











  • Thank you for the link @terdon!

    – BhushanDhamale
    Apr 5 at 12:57
















It looks like you might also be interested in our sister site: Bioinformatics.

– terdon
Apr 5 at 12:54





It looks like you might also be interested in our sister site: Bioinformatics.

– terdon
Apr 5 at 12:54













Thank you for the link @terdon!

– BhushanDhamale
Apr 5 at 12:57





Thank you for the link @terdon!

– BhushanDhamale
Apr 5 at 12:57










3 Answers
3






active

oldest

votes


















13














You can do this very easily with awk:



$ awk 'NR==FNRa[$1]=$2; next$1=a[$1]; print' file2 file1
GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7


Or, since that looks like a tab-separated file:



$ awk -vOFS="t" 'NR==FNRa[$1]=$2; next$1=a[$1]; print' file2 file1
GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7


This assumes that every RefSeq (NC_*) id in file1 has a corresponding entry in file2.



Explanation




  • NR==FNR : NR is the current line number, FNR is the line number of the current file. The two will be identical only while the 1st file (here, file2) is being read.


  • a[$1]=$2; next: if this is the first file (see above), save the 2nd field in an array whose key is the 1st field. Then, move on to the next line. This ensures the next block isn't executed for the 1st file.


  • $1=a[$1]; print : now, in the second file, set the 1st field to whatever value was saved in the array a for the 1st field (so, the associated value from file2) and print the resulting line.





share|improve this answer




















  • 1





    NR == FNR doesn't work correctly when the first file is empty. See this and the associated answer for a workaround

    – iruvar
    Apr 5 at 12:44







  • 1





    @iruvar nothing will work well if the first file is empty, so I don't really see why that's relevant. The entire point here is to combine the data from the two files. If either file is empty, the whole exercise is pointless.

    – terdon
    Apr 5 at 12:45












  • sorry I should have said in this particular case file2 and not file1 is empty. Sane behaviour when file2 is empty is to report the contents of file1. The problem with NR == FNR is that code associated with it executes on the contents of file1 when file2 is empty

    – iruvar
    Apr 5 at 12:51






  • 1





    @iruvar there is no sane behavior here if either file is empty. That's what I'm saying :) So trying to make it deal with that case gracefully is pointless. And, in any case, when either file is empty here, nothing is printed. Which actually seems like the sanest approach, I'd rather get no data than wrong data.

    – terdon
    Apr 5 at 12:54



















16














No need for awk, assuming the files are sorted, you can use coreutils join:



join -o '2.2 1.2 1.3 1.4 1.5' file1 file2


Output:



GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7


If your files aren't, sorted, you can either sort them first (sort file1 > file1.sorted; sort file2 > file2.sorted) and then use the command above, or, if your shell supports the <() construct (bash does), you can do:



join -o '2.2 1.2 1.3 1.4 1.5' <(sort file1) <(sort file2)





share|improve this answer
































    0














    Tested with below command and worked fine



    for i in `awk 'print $1' f2`; do k=`awk -v i="$i" '$1==i print $2' f2`;sed "/$i/s/$i/$k/g" f1 >f3;done


    output



    for i in `awk 'print $1' f2`; do k=`awk -v i="$i" '$1==i print $2' f2`;sed "/$i/s/$i/$k/g" f1 >f3;done


    GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
    GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
    GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
    GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
    GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
    GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
    GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
    GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
    GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7





    share|improve this answer























      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );






      BhushanDhamale is a new contributor. Be nice, and check out our Code of Conduct.









      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f510709%2freplacing-matching-entries-in-one-column-of-a-file-by-another-column-from-a-diff%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      13














      You can do this very easily with awk:



      $ awk 'NR==FNRa[$1]=$2; next$1=a[$1]; print' file2 file1
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
      GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
      GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
      GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7


      Or, since that looks like a tab-separated file:



      $ awk -vOFS="t" 'NR==FNRa[$1]=$2; next$1=a[$1]; print' file2 file1
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
      GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
      GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
      GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7


      This assumes that every RefSeq (NC_*) id in file1 has a corresponding entry in file2.



      Explanation




      • NR==FNR : NR is the current line number, FNR is the line number of the current file. The two will be identical only while the 1st file (here, file2) is being read.


      • a[$1]=$2; next: if this is the first file (see above), save the 2nd field in an array whose key is the 1st field. Then, move on to the next line. This ensures the next block isn't executed for the 1st file.


      • $1=a[$1]; print : now, in the second file, set the 1st field to whatever value was saved in the array a for the 1st field (so, the associated value from file2) and print the resulting line.





      share|improve this answer




















      • 1





        NR == FNR doesn't work correctly when the first file is empty. See this and the associated answer for a workaround

        – iruvar
        Apr 5 at 12:44







      • 1





        @iruvar nothing will work well if the first file is empty, so I don't really see why that's relevant. The entire point here is to combine the data from the two files. If either file is empty, the whole exercise is pointless.

        – terdon
        Apr 5 at 12:45












      • sorry I should have said in this particular case file2 and not file1 is empty. Sane behaviour when file2 is empty is to report the contents of file1. The problem with NR == FNR is that code associated with it executes on the contents of file1 when file2 is empty

        – iruvar
        Apr 5 at 12:51






      • 1





        @iruvar there is no sane behavior here if either file is empty. That's what I'm saying :) So trying to make it deal with that case gracefully is pointless. And, in any case, when either file is empty here, nothing is printed. Which actually seems like the sanest approach, I'd rather get no data than wrong data.

        – terdon
        Apr 5 at 12:54
















      13














      You can do this very easily with awk:



      $ awk 'NR==FNRa[$1]=$2; next$1=a[$1]; print' file2 file1
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
      GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
      GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
      GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7


      Or, since that looks like a tab-separated file:



      $ awk -vOFS="t" 'NR==FNRa[$1]=$2; next$1=a[$1]; print' file2 file1
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
      GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
      GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
      GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7


      This assumes that every RefSeq (NC_*) id in file1 has a corresponding entry in file2.



      Explanation




      • NR==FNR : NR is the current line number, FNR is the line number of the current file. The two will be identical only while the 1st file (here, file2) is being read.


      • a[$1]=$2; next: if this is the first file (see above), save the 2nd field in an array whose key is the 1st field. Then, move on to the next line. This ensures the next block isn't executed for the 1st file.


      • $1=a[$1]; print : now, in the second file, set the 1st field to whatever value was saved in the array a for the 1st field (so, the associated value from file2) and print the resulting line.





      share|improve this answer




















      • 1





        NR == FNR doesn't work correctly when the first file is empty. See this and the associated answer for a workaround

        – iruvar
        Apr 5 at 12:44







      • 1





        @iruvar nothing will work well if the first file is empty, so I don't really see why that's relevant. The entire point here is to combine the data from the two files. If either file is empty, the whole exercise is pointless.

        – terdon
        Apr 5 at 12:45












      • sorry I should have said in this particular case file2 and not file1 is empty. Sane behaviour when file2 is empty is to report the contents of file1. The problem with NR == FNR is that code associated with it executes on the contents of file1 when file2 is empty

        – iruvar
        Apr 5 at 12:51






      • 1





        @iruvar there is no sane behavior here if either file is empty. That's what I'm saying :) So trying to make it deal with that case gracefully is pointless. And, in any case, when either file is empty here, nothing is printed. Which actually seems like the sanest approach, I'd rather get no data than wrong data.

        – terdon
        Apr 5 at 12:54














      13












      13








      13







      You can do this very easily with awk:



      $ awk 'NR==FNRa[$1]=$2; next$1=a[$1]; print' file2 file1
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
      GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
      GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
      GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7


      Or, since that looks like a tab-separated file:



      $ awk -vOFS="t" 'NR==FNRa[$1]=$2; next$1=a[$1]; print' file2 file1
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
      GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
      GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
      GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7


      This assumes that every RefSeq (NC_*) id in file1 has a corresponding entry in file2.



      Explanation




      • NR==FNR : NR is the current line number, FNR is the line number of the current file. The two will be identical only while the 1st file (here, file2) is being read.


      • a[$1]=$2; next: if this is the first file (see above), save the 2nd field in an array whose key is the 1st field. Then, move on to the next line. This ensures the next block isn't executed for the 1st file.


      • $1=a[$1]; print : now, in the second file, set the 1st field to whatever value was saved in the array a for the 1st field (so, the associated value from file2) and print the resulting line.





      share|improve this answer















      You can do this very easily with awk:



      $ awk 'NR==FNRa[$1]=$2; next$1=a[$1]; print' file2 file1
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
      GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
      GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
      GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7


      Or, since that looks like a tab-separated file:



      $ awk -vOFS="t" 'NR==FNRa[$1]=$2; next$1=a[$1]; print' file2 file1
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
      GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
      GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
      GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7


      This assumes that every RefSeq (NC_*) id in file1 has a corresponding entry in file2.



      Explanation




      • NR==FNR : NR is the current line number, FNR is the line number of the current file. The two will be identical only while the 1st file (here, file2) is being read.


      • a[$1]=$2; next: if this is the first file (see above), save the 2nd field in an array whose key is the 1st field. Then, move on to the next line. This ensures the next block isn't executed for the 1st file.


      • $1=a[$1]; print : now, in the second file, set the 1st field to whatever value was saved in the array a for the 1st field (so, the associated value from file2) and print the resulting line.






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Apr 5 at 12:50

























      answered Apr 5 at 12:38









      terdonterdon

      134k33269449




      134k33269449







      • 1





        NR == FNR doesn't work correctly when the first file is empty. See this and the associated answer for a workaround

        – iruvar
        Apr 5 at 12:44







      • 1





        @iruvar nothing will work well if the first file is empty, so I don't really see why that's relevant. The entire point here is to combine the data from the two files. If either file is empty, the whole exercise is pointless.

        – terdon
        Apr 5 at 12:45












      • sorry I should have said in this particular case file2 and not file1 is empty. Sane behaviour when file2 is empty is to report the contents of file1. The problem with NR == FNR is that code associated with it executes on the contents of file1 when file2 is empty

        – iruvar
        Apr 5 at 12:51






      • 1





        @iruvar there is no sane behavior here if either file is empty. That's what I'm saying :) So trying to make it deal with that case gracefully is pointless. And, in any case, when either file is empty here, nothing is printed. Which actually seems like the sanest approach, I'd rather get no data than wrong data.

        – terdon
        Apr 5 at 12:54













      • 1





        NR == FNR doesn't work correctly when the first file is empty. See this and the associated answer for a workaround

        – iruvar
        Apr 5 at 12:44







      • 1





        @iruvar nothing will work well if the first file is empty, so I don't really see why that's relevant. The entire point here is to combine the data from the two files. If either file is empty, the whole exercise is pointless.

        – terdon
        Apr 5 at 12:45












      • sorry I should have said in this particular case file2 and not file1 is empty. Sane behaviour when file2 is empty is to report the contents of file1. The problem with NR == FNR is that code associated with it executes on the contents of file1 when file2 is empty

        – iruvar
        Apr 5 at 12:51






      • 1





        @iruvar there is no sane behavior here if either file is empty. That's what I'm saying :) So trying to make it deal with that case gracefully is pointless. And, in any case, when either file is empty here, nothing is printed. Which actually seems like the sanest approach, I'd rather get no data than wrong data.

        – terdon
        Apr 5 at 12:54








      1




      1





      NR == FNR doesn't work correctly when the first file is empty. See this and the associated answer for a workaround

      – iruvar
      Apr 5 at 12:44






      NR == FNR doesn't work correctly when the first file is empty. See this and the associated answer for a workaround

      – iruvar
      Apr 5 at 12:44





      1




      1





      @iruvar nothing will work well if the first file is empty, so I don't really see why that's relevant. The entire point here is to combine the data from the two files. If either file is empty, the whole exercise is pointless.

      – terdon
      Apr 5 at 12:45






      @iruvar nothing will work well if the first file is empty, so I don't really see why that's relevant. The entire point here is to combine the data from the two files. If either file is empty, the whole exercise is pointless.

      – terdon
      Apr 5 at 12:45














      sorry I should have said in this particular case file2 and not file1 is empty. Sane behaviour when file2 is empty is to report the contents of file1. The problem with NR == FNR is that code associated with it executes on the contents of file1 when file2 is empty

      – iruvar
      Apr 5 at 12:51





      sorry I should have said in this particular case file2 and not file1 is empty. Sane behaviour when file2 is empty is to report the contents of file1. The problem with NR == FNR is that code associated with it executes on the contents of file1 when file2 is empty

      – iruvar
      Apr 5 at 12:51




      1




      1





      @iruvar there is no sane behavior here if either file is empty. That's what I'm saying :) So trying to make it deal with that case gracefully is pointless. And, in any case, when either file is empty here, nothing is printed. Which actually seems like the sanest approach, I'd rather get no data than wrong data.

      – terdon
      Apr 5 at 12:54






      @iruvar there is no sane behavior here if either file is empty. That's what I'm saying :) So trying to make it deal with that case gracefully is pointless. And, in any case, when either file is empty here, nothing is printed. Which actually seems like the sanest approach, I'd rather get no data than wrong data.

      – terdon
      Apr 5 at 12:54














      16














      No need for awk, assuming the files are sorted, you can use coreutils join:



      join -o '2.2 1.2 1.3 1.4 1.5' file1 file2


      Output:



      GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
      GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
      GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
      GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
      GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
      GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7


      If your files aren't, sorted, you can either sort them first (sort file1 > file1.sorted; sort file2 > file2.sorted) and then use the command above, or, if your shell supports the <() construct (bash does), you can do:



      join -o '2.2 1.2 1.3 1.4 1.5' <(sort file1) <(sort file2)





      share|improve this answer





























        16














        No need for awk, assuming the files are sorted, you can use coreutils join:



        join -o '2.2 1.2 1.3 1.4 1.5' file1 file2


        Output:



        GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
        GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
        GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
        GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
        GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
        GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
        GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
        GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
        GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7


        If your files aren't, sorted, you can either sort them first (sort file1 > file1.sorted; sort file2 > file2.sorted) and then use the command above, or, if your shell supports the <() construct (bash does), you can do:



        join -o '2.2 1.2 1.3 1.4 1.5' <(sort file1) <(sort file2)





        share|improve this answer



























          16












          16








          16







          No need for awk, assuming the files are sorted, you can use coreutils join:



          join -o '2.2 1.2 1.3 1.4 1.5' file1 file2


          Output:



          GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
          GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
          GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
          GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
          GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
          GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
          GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
          GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
          GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7


          If your files aren't, sorted, you can either sort them first (sort file1 > file1.sorted; sort file2 > file2.sorted) and then use the command above, or, if your shell supports the <() construct (bash does), you can do:



          join -o '2.2 1.2 1.3 1.4 1.5' <(sort file1) <(sort file2)





          share|improve this answer















          No need for awk, assuming the files are sorted, you can use coreutils join:



          join -o '2.2 1.2 1.3 1.4 1.5' file1 file2


          Output:



          GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
          GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
          GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
          GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
          GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
          GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
          GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
          GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
          GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7


          If your files aren't, sorted, you can either sort them first (sort file1 > file1.sorted; sort file2 > file2.sorted) and then use the command above, or, if your shell supports the <() construct (bash does), you can do:



          join -o '2.2 1.2 1.3 1.4 1.5' <(sort file1) <(sort file2)






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 5 at 13:00









          terdon

          134k33269449




          134k33269449










          answered Apr 5 at 12:39









          ThorThor

          12.2k13762




          12.2k13762





















              0














              Tested with below command and worked fine



              for i in `awk 'print $1' f2`; do k=`awk -v i="$i" '$1==i print $2' f2`;sed "/$i/s/$i/$k/g" f1 >f3;done


              output



              for i in `awk 'print $1' f2`; do k=`awk -v i="$i" '$1==i print $2' f2`;sed "/$i/s/$i/$k/g" f1 >f3;done


              GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
              GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
              GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
              GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
              GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
              GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
              GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
              GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
              GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7





              share|improve this answer



























                0














                Tested with below command and worked fine



                for i in `awk 'print $1' f2`; do k=`awk -v i="$i" '$1==i print $2' f2`;sed "/$i/s/$i/$k/g" f1 >f3;done


                output



                for i in `awk 'print $1' f2`; do k=`awk -v i="$i" '$1==i print $2' f2`;sed "/$i/s/$i/$k/g" f1 >f3;done


                GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
                GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
                GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
                GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
                GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
                GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
                GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
                GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
                GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7





                share|improve this answer

























                  0












                  0








                  0







                  Tested with below command and worked fine



                  for i in `awk 'print $1' f2`; do k=`awk -v i="$i" '$1==i print $2' f2`;sed "/$i/s/$i/$k/g" f1 >f3;done


                  output



                  for i in `awk 'print $1' f2`; do k=`awk -v i="$i" '$1==i print $2' f2`;sed "/$i/s/$i/$k/g" f1 >f3;done


                  GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
                  GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
                  GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
                  GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
                  GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
                  GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
                  GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
                  GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
                  GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7





                  share|improve this answer













                  Tested with below command and worked fine



                  for i in `awk 'print $1' f2`; do k=`awk -v i="$i" '$1==i print $2' f2`;sed "/$i/s/$i/$k/g" f1 >f3;done


                  output



                  for i in `awk 'print $1' f2`; do k=`awk -v i="$i" '$1==i print $2' f2`;sed "/$i/s/$i/$k/g" f1 >f3;done


                  GCF_000014165.1_ASM1416v1_protein.faa WP_011558474.1 1155234 1156286 44173
                  GCF_000014165.1_ASM1416v1_protein.faa WP_011558475.1 1156298 1156807 12
                  GCF_000014165.1_ASM1416v1_protein.faa WP_011558476.1 1156804 1157820 -3
                  GCF_000015405.1_ASM1540v1_protein.faa WP_011558474.1 1159543 1160595 42748
                  GCF_000015405.1_ASM1540v1_protein.faa WP_011558475.1 1160607 1161116 12
                  GCF_000015405.1_ASM1540v1_protein.faa WP_011558476.1 1161113 1162129 -3
                  GCF_000016005.1_ASM1600v1_protein.faa WP_011559727.1 2481079 2481633 8
                  GCF_000016005.1_ASM1600v1_protein.faa WP_011854835.1 1163068 1164120 42559
                  GCF_000016005.1_ASM1600v1_protein.faa WP_011854836.1 1164127 1164636 7






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Apr 7 at 13:47









                  Praveen Kumar BSPraveen Kumar BS

                  1,7641311




                  1,7641311




















                      BhushanDhamale is a new contributor. Be nice, and check out our Code of Conduct.









                      draft saved

                      draft discarded


















                      BhushanDhamale is a new contributor. Be nice, and check out our Code of Conduct.












                      BhushanDhamale is a new contributor. Be nice, and check out our Code of Conduct.











                      BhushanDhamale is a new contributor. Be nice, and check out our Code of Conduct.














                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f510709%2freplacing-matching-entries-in-one-column-of-a-file-by-another-column-from-a-diff%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      រឿង រ៉ូមេអូ និង ហ្ស៊ុយលីយេ សង្ខេបរឿង តួអង្គ បញ្ជីណែនាំ

                      Crop image to path created in TikZ? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Crop an inserted image?TikZ pictures does not appear in posterImage behind and beyond crop marks?Tikz picture as large as possible on A4 PageTransparency vs image compression dilemmaHow to crop background from image automatically?Image does not cropTikzexternal capturing crop marks when externalizing pgfplots?How to include image path that contains a dollar signCrop image with left size given

                      Romeo and Juliet ContentsCharactersSynopsisSourcesDate and textThemes and motifsCriticism and interpretationLegacyScene by sceneSee alsoNotes and referencesSourcesExternal linksNavigation menu"Consumer Price Index (estimate) 1800–"10.2307/28710160037-3222287101610.1093/res/II.5.31910.2307/45967845967810.2307/2869925286992510.1525/jams.1982.35.3.03a00050"Dada Masilo: South African dancer who breaks the rules"10.1093/res/os-XV.57.1610.2307/28680942868094"Sweet Sorrow: Mann-Korman's Romeo and Juliet Closes Sept. 5 at MN's Ordway"the original10.2307/45957745957710.1017/CCOL0521570476.009"Ram Leela box office collections hit massive Rs 100 crore, pulverises prediction"Archived"Broadway Revival of Romeo and Juliet, Starring Orlando Bloom and Condola Rashad, Will Close Dec. 8"Archived10.1075/jhp.7.1.04hon"Wherefore art thou, Romeo? To make us laugh at Navy Pier"the original10.1093/gmo/9781561592630.article.O006772"Ram-leela Review Roundup: Critics Hail Film as Best Adaptation of Romeo and Juliet"Archived10.2307/31946310047-77293194631"Romeo and Juliet get Twitter treatment""Juliet's Nurse by Lois Leveen""Romeo and Juliet: Orlando Bloom's Broadway Debut Released in Theaters for Valentine's Day"Archived"Romeo and Juliet Has No Balcony"10.1093/gmo/9781561592630.article.O00778110.2307/2867423286742310.1076/enst.82.2.115.959510.1080/00138380601042675"A plague o' both your houses: error in GCSE exam paper forces apology""Juliet of the Five O'Clock Shadow, and Other Wonders"10.2307/33912430027-4321339124310.2307/28487440038-7134284874410.2307/29123140149-661129123144728341M"Weekender Guide: Shakespeare on The Drive""balcony"UK public library membership"romeo"UK public library membership10.1017/CCOL9780521844291"Post-Zionist Critique on Israel and the Palestinians Part III: Popular Culture"10.2307/25379071533-86140377-919X2537907"Capulets and Montagues: UK exam board admit mixing names up in Romeo and Juliet paper"Istoria Novellamente Ritrovata di Due Nobili Amanti2027/mdp.390150822329610820-750X"GCSE exam error: Board accidentally rewrites Shakespeare"10.2307/29176390149-66112917639"Exam board apologises after error in English GCSE paper which confused characters in Shakespeare's Romeo and Juliet""From Mariotto and Ganozza to Romeo and Guilietta: Metamorphoses of a Renaissance Tale"10.2307/37323537323510.2307/2867455286745510.2307/28678912867891"10 Questions for Taylor Swift"10.2307/28680922868092"Haymarket Theatre""The Zeffirelli Way: Revealing Talk by Florentine Director""Michael Smuin: 1938-2007 / Prolific dance director had showy career"The Life and Art of Edwin BoothRomeo and JulietRomeo and JulietRomeo and JulietRomeo and JulietEasy Read Romeo and JulietRomeo and Julieteeecb12003684p(data)4099369-3n8211610759dbe00d-a9e2-41a3-b2c1-977dd692899302814385X313670221313670221