Gawk cross referencingGet last set of non-empty lineshow to use concatenate command inside the awk commandHow...

How did the Force make Luke hard to hit in the Battle of Yavin?

Which version of the Squat Nimbleness feat is correct?

The selling of the sheep

How to deal with employer who keeps me at work after working hours

Dual frame in Riemannian metrics.

HSA - Continue to Invest?

Collision domain question

What detail can Hubble see on Mars?

How is Pauli's exclusion principle still valid in these cases?

Does Thanos's ship land in the middle of the battlefield in "Avengers: Endgame"?

Convert Numbers To Emoji Math

Efficient deletion of specific list entries

Referring to person by surname, keep or omit "von"?

Can a good but unremarkable PhD student become an accomplished professor?

Can a player choose to add detail and flavor to their character's spells and abilities?

Playing Doublets with the Primes

Why increasing of the temperature of the objects like wood, paper etc. doesn't fire them?

Ab major 9th chord in Bach

Changing stroke width vertically but not horizontally in Inkscape

Copper as an adjective to refer to something made of copper

Why can’t you see at the start of the Big Bang?

How to replace space with '+' symbol in a triangular array?

What is the meaning of 「隣のおじいさんは言いました」

Do quaternary sulfur dications exist?



Gawk cross referencing


Get last set of non-empty lineshow to use concatenate command inside the awk commandHow to output some data to different cells of an Excel File?extract the data from 2 fileshow to print only Difference in two files using NR=FNR?How do I append text from one line, to the end of another?AWK - print last column along with empty valueGawk partial matchAwk: setting a record to a pattern match, then print only the last recordawk for loop on files in directory






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







0















I'm having a issue with cross referencing data using gawk, when I use:



gawk -F: 'FNR==NR{a[$1]=$2;next} $2 in a{print $1 FS a[$2]}' email.phone.txt name.email.txt > name.phone.txt


Example of email.phone contents:



Email@gmail.com:012345
Email@gmail.com:912345


Example of name.email.txt:



Charles:Email@gmail.com
Erica:Email@gmail.com


Expected output



Charles:012345
Charles:912345
Erica:012345
Erica:912345


However it only outputs the last matching phone using that email, so it will only output:



Charles:912345
Erica:912345


and dismiss the first phone used with that email..










share|improve this question







New contributor




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



























    0















    I'm having a issue with cross referencing data using gawk, when I use:



    gawk -F: 'FNR==NR{a[$1]=$2;next} $2 in a{print $1 FS a[$2]}' email.phone.txt name.email.txt > name.phone.txt


    Example of email.phone contents:



    Email@gmail.com:012345
    Email@gmail.com:912345


    Example of name.email.txt:



    Charles:Email@gmail.com
    Erica:Email@gmail.com


    Expected output



    Charles:012345
    Charles:912345
    Erica:012345
    Erica:912345


    However it only outputs the last matching phone using that email, so it will only output:



    Charles:912345
    Erica:912345


    and dismiss the first phone used with that email..










    share|improve this question







    New contributor




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























      0












      0








      0








      I'm having a issue with cross referencing data using gawk, when I use:



      gawk -F: 'FNR==NR{a[$1]=$2;next} $2 in a{print $1 FS a[$2]}' email.phone.txt name.email.txt > name.phone.txt


      Example of email.phone contents:



      Email@gmail.com:012345
      Email@gmail.com:912345


      Example of name.email.txt:



      Charles:Email@gmail.com
      Erica:Email@gmail.com


      Expected output



      Charles:012345
      Charles:912345
      Erica:012345
      Erica:912345


      However it only outputs the last matching phone using that email, so it will only output:



      Charles:912345
      Erica:912345


      and dismiss the first phone used with that email..










      share|improve this question







      New contributor




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












      I'm having a issue with cross referencing data using gawk, when I use:



      gawk -F: 'FNR==NR{a[$1]=$2;next} $2 in a{print $1 FS a[$2]}' email.phone.txt name.email.txt > name.phone.txt


      Example of email.phone contents:



      Email@gmail.com:012345
      Email@gmail.com:912345


      Example of name.email.txt:



      Charles:Email@gmail.com
      Erica:Email@gmail.com


      Expected output



      Charles:012345
      Charles:912345
      Erica:012345
      Erica:912345


      However it only outputs the last matching phone using that email, so it will only output:



      Charles:912345
      Erica:912345


      and dismiss the first phone used with that email..







      bash awk gawk






      share|improve this question







      New contributor




      user351531 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




      user351531 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






      New contributor




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









      asked 2 hours ago









      user351531user351531

      31




      31




      New contributor




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





      New contributor





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






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






















          1 Answer
          1






          active

          oldest

          votes


















          0














          GNU awk (gawk) --but not regular awk-- supports true multi-dimensional arrays, and you could use that:



          gawk -F: '
          FNR==NR{a[$1][$2]=1;next}
          $2 in a{for(i in a[$2]) print $1 FS i}
          ' email.phone.txt name.email.txt





          share|improve this answer


























          • Thanks for your help, fixed my issue! :)

            – user351531
            1 hour ago












          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
          });


          }
          });






          user351531 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%2f517320%2fgawk-cross-referencing%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          GNU awk (gawk) --but not regular awk-- supports true multi-dimensional arrays, and you could use that:



          gawk -F: '
          FNR==NR{a[$1][$2]=1;next}
          $2 in a{for(i in a[$2]) print $1 FS i}
          ' email.phone.txt name.email.txt





          share|improve this answer


























          • Thanks for your help, fixed my issue! :)

            – user351531
            1 hour ago
















          0














          GNU awk (gawk) --but not regular awk-- supports true multi-dimensional arrays, and you could use that:



          gawk -F: '
          FNR==NR{a[$1][$2]=1;next}
          $2 in a{for(i in a[$2]) print $1 FS i}
          ' email.phone.txt name.email.txt





          share|improve this answer


























          • Thanks for your help, fixed my issue! :)

            – user351531
            1 hour ago














          0












          0








          0







          GNU awk (gawk) --but not regular awk-- supports true multi-dimensional arrays, and you could use that:



          gawk -F: '
          FNR==NR{a[$1][$2]=1;next}
          $2 in a{for(i in a[$2]) print $1 FS i}
          ' email.phone.txt name.email.txt





          share|improve this answer















          GNU awk (gawk) --but not regular awk-- supports true multi-dimensional arrays, and you could use that:



          gawk -F: '
          FNR==NR{a[$1][$2]=1;next}
          $2 in a{for(i in a[$2]) print $1 FS i}
          ' email.phone.txt name.email.txt






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 1 hour ago

























          answered 2 hours ago









          pizdelectpizdelect

          1,087211




          1,087211













          • Thanks for your help, fixed my issue! :)

            – user351531
            1 hour ago



















          • Thanks for your help, fixed my issue! :)

            – user351531
            1 hour ago

















          Thanks for your help, fixed my issue! :)

          – user351531
          1 hour ago





          Thanks for your help, fixed my issue! :)

          – user351531
          1 hour ago










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










          draft saved

          draft discarded


















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













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












          user351531 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%2f517320%2fgawk-cross-referencing%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

          Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

          Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

          Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...