Join commands not working as expectedJoin two files with matching columnsHow to join two files based on...

Row to remove the dotted white border around focused button text

Procedurally generate regions on island

SPI Waveform on Raspberry Pi Not clean and I'm wondering why

Set vertical spacing between two particular items

Should I tell my insurance company I have an unsecured loan for my new car?

If my Scout rogue has used his full movement on his turn, can he later use the reaction from the Skirmisher feature to move again?

Is there a short way to check uniqueness of values without using 'if' and multiple 'and's?

How to write or read powers (math) by words?

Dold-Kan correspondence in the category of symmetric spectra

Generate and graph the Recamán Sequence

What happens when your group is victim of a surprise attack but you can't be surprised?

When is it ok to add filler to a story?

Was "I have the farts, again" broadcast from the Moon to the whole world?

Professor Roman gives unusual math quiz ahead of

Does the UK have a written constitution?

How should I behave to assure my friends that I am not after their money?

Is this the golf ball that Alan Shepard hit on the Moon?

Why is the Turkish president's surname spelt in Russian as Эрдоган, with г?

The difference between Rad1 and Rfd1

How likely is sample A and sample B is from distribution C?

How to convert object fill in to fine lines?

Avoid bfseries from bolding pm in siunitx

How fast can a ship with rotating habitats be accelerated?

What is the line crossing the Pacific Ocean that is shown on maps?



Join commands not working as expected


Join two files with matching columnsHow to join two files based on fields with out rearrange the colums order?Merge and print matching and non matching values between a smaller file and a huge fileHow join two files by one common column (1ª) between two file (File1 and file2)?Error in awk for merge filesHow to join 2 files based on common rows of first columns?Joining entries based off of column using awk/joinJoin two csv files by matching columns, join commandMerging two files and creating a new one. file 1 has got more than 100 colmns and file 2 has got 2Merge two texts with comparison of the rows and select one text's rows if some columns are similar






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







0















I am trying to join two files with different rows but one element in common.



FILE1:



1/temperature
2/rainfall
3/snowfall
4/windspeed
5/winddirection


FILE2:



2008-10-01/1/68
2008-10-02/2/6
2008-10-03/3/4
2008-10-04/4/25
2008-10-05/5/120
2008-10-01/1/89
2008-10-01/4/35
2008-11-01/5/360
2008-10-01/1/45
2008-12-01/1/61
2008-10-10/1/32


I am trying to join both files using the following command



join -t/ -1 1 -2 2 FILE1 FILE2


I AM EXPECTING TO HAVE THE FOLLOWING OUTPUT:



1/temperature/2008-10-01/68
1/temperature/2008-10-01/89
1/temperature/2008-10-01/45
1/temperature/2008-12-01/61
1/temperature/2008-10-10/32
2/rainfall/2008-10-02/6
3/snowfall/2008-10-03/4
4/windspeed/2008-10-04/25
4/windspeed/2008-10-01/35
5/winddirection/2008-10-05/120
5/winddirection/2008-11-01/360


but I am having the first 5 rows in this way:



1/temperature/2008-10-01/68
2/rainfall/2008-10-02/6
3/snowfall/2008-10-03/4
4/windspeed/2008-10-04/25
5/winddirection/2008-10-05/120


Please your help what I am doing wrong










share|improve this question









New contributor



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


























    0















    I am trying to join two files with different rows but one element in common.



    FILE1:



    1/temperature
    2/rainfall
    3/snowfall
    4/windspeed
    5/winddirection


    FILE2:



    2008-10-01/1/68
    2008-10-02/2/6
    2008-10-03/3/4
    2008-10-04/4/25
    2008-10-05/5/120
    2008-10-01/1/89
    2008-10-01/4/35
    2008-11-01/5/360
    2008-10-01/1/45
    2008-12-01/1/61
    2008-10-10/1/32


    I am trying to join both files using the following command



    join -t/ -1 1 -2 2 FILE1 FILE2


    I AM EXPECTING TO HAVE THE FOLLOWING OUTPUT:



    1/temperature/2008-10-01/68
    1/temperature/2008-10-01/89
    1/temperature/2008-10-01/45
    1/temperature/2008-12-01/61
    1/temperature/2008-10-10/32
    2/rainfall/2008-10-02/6
    3/snowfall/2008-10-03/4
    4/windspeed/2008-10-04/25
    4/windspeed/2008-10-01/35
    5/winddirection/2008-10-05/120
    5/winddirection/2008-11-01/360


    but I am having the first 5 rows in this way:



    1/temperature/2008-10-01/68
    2/rainfall/2008-10-02/6
    3/snowfall/2008-10-03/4
    4/windspeed/2008-10-04/25
    5/winddirection/2008-10-05/120


    Please your help what I am doing wrong










    share|improve this question









    New contributor



    Gonzalo Ponce 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 am trying to join two files with different rows but one element in common.



      FILE1:



      1/temperature
      2/rainfall
      3/snowfall
      4/windspeed
      5/winddirection


      FILE2:



      2008-10-01/1/68
      2008-10-02/2/6
      2008-10-03/3/4
      2008-10-04/4/25
      2008-10-05/5/120
      2008-10-01/1/89
      2008-10-01/4/35
      2008-11-01/5/360
      2008-10-01/1/45
      2008-12-01/1/61
      2008-10-10/1/32


      I am trying to join both files using the following command



      join -t/ -1 1 -2 2 FILE1 FILE2


      I AM EXPECTING TO HAVE THE FOLLOWING OUTPUT:



      1/temperature/2008-10-01/68
      1/temperature/2008-10-01/89
      1/temperature/2008-10-01/45
      1/temperature/2008-12-01/61
      1/temperature/2008-10-10/32
      2/rainfall/2008-10-02/6
      3/snowfall/2008-10-03/4
      4/windspeed/2008-10-04/25
      4/windspeed/2008-10-01/35
      5/winddirection/2008-10-05/120
      5/winddirection/2008-11-01/360


      but I am having the first 5 rows in this way:



      1/temperature/2008-10-01/68
      2/rainfall/2008-10-02/6
      3/snowfall/2008-10-03/4
      4/windspeed/2008-10-04/25
      5/winddirection/2008-10-05/120


      Please your help what I am doing wrong










      share|improve this question









      New contributor



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











      I am trying to join two files with different rows but one element in common.



      FILE1:



      1/temperature
      2/rainfall
      3/snowfall
      4/windspeed
      5/winddirection


      FILE2:



      2008-10-01/1/68
      2008-10-02/2/6
      2008-10-03/3/4
      2008-10-04/4/25
      2008-10-05/5/120
      2008-10-01/1/89
      2008-10-01/4/35
      2008-11-01/5/360
      2008-10-01/1/45
      2008-12-01/1/61
      2008-10-10/1/32


      I am trying to join both files using the following command



      join -t/ -1 1 -2 2 FILE1 FILE2


      I AM EXPECTING TO HAVE THE FOLLOWING OUTPUT:



      1/temperature/2008-10-01/68
      1/temperature/2008-10-01/89
      1/temperature/2008-10-01/45
      1/temperature/2008-12-01/61
      1/temperature/2008-10-10/32
      2/rainfall/2008-10-02/6
      3/snowfall/2008-10-03/4
      4/windspeed/2008-10-04/25
      4/windspeed/2008-10-01/35
      5/winddirection/2008-10-05/120
      5/winddirection/2008-11-01/360


      but I am having the first 5 rows in this way:



      1/temperature/2008-10-01/68
      2/rainfall/2008-10-02/6
      3/snowfall/2008-10-03/4
      4/windspeed/2008-10-04/25
      5/winddirection/2008-10-05/120


      Please your help what I am doing wrong







      join






      share|improve this question









      New contributor



      Gonzalo Ponce 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



      Gonzalo Ponce 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 20 mins ago









      steeldriver

      40.1k4 gold badges54 silver badges93 bronze badges




      40.1k4 gold badges54 silver badges93 bronze badges






      New contributor



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








      asked 23 mins ago









      Gonzalo PonceGonzalo Ponce

      11 bronze badge




      11 bronze badge




      New contributor



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




      New contributor




      Gonzalo Ponce 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














          join expects its inputs to be sorted (on the fields that are to be joined). In this case (making use of the bash shell's process substitution):



          $ join -t/ -1 1 -2 2 FILE1 <(sort -t/ -k2 FILE2)
          1/temperature/2008-10-10/32
          1/temperature/2008-10-01/45
          1/temperature/2008-12-01/61
          1/temperature/2008-10-01/68
          1/temperature/2008-10-01/89
          2/rainfall/2008-10-02/6
          3/snowfall/2008-10-03/4
          4/windspeed/2008-10-04/25
          4/windspeed/2008-10-01/35
          5/winddirection/2008-10-05/120
          5/winddirection/2008-11-01/360


          Note that the required sorting is lexical rather than numeric - if the first column values in FILE1 exceed 9, then you will likely need to pre-sort that as well.






          share|improve this answer
























          • Many thanks my friend. finally worked. Steeldriver you deserve a medal

            – Gonzalo Ponce
            4 mins 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
          });


          }
          });






          Gonzalo Ponce 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%2f526542%2fjoin-commands-not-working-as-expected%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














          join expects its inputs to be sorted (on the fields that are to be joined). In this case (making use of the bash shell's process substitution):



          $ join -t/ -1 1 -2 2 FILE1 <(sort -t/ -k2 FILE2)
          1/temperature/2008-10-10/32
          1/temperature/2008-10-01/45
          1/temperature/2008-12-01/61
          1/temperature/2008-10-01/68
          1/temperature/2008-10-01/89
          2/rainfall/2008-10-02/6
          3/snowfall/2008-10-03/4
          4/windspeed/2008-10-04/25
          4/windspeed/2008-10-01/35
          5/winddirection/2008-10-05/120
          5/winddirection/2008-11-01/360


          Note that the required sorting is lexical rather than numeric - if the first column values in FILE1 exceed 9, then you will likely need to pre-sort that as well.






          share|improve this answer
























          • Many thanks my friend. finally worked. Steeldriver you deserve a medal

            – Gonzalo Ponce
            4 mins ago
















          0














          join expects its inputs to be sorted (on the fields that are to be joined). In this case (making use of the bash shell's process substitution):



          $ join -t/ -1 1 -2 2 FILE1 <(sort -t/ -k2 FILE2)
          1/temperature/2008-10-10/32
          1/temperature/2008-10-01/45
          1/temperature/2008-12-01/61
          1/temperature/2008-10-01/68
          1/temperature/2008-10-01/89
          2/rainfall/2008-10-02/6
          3/snowfall/2008-10-03/4
          4/windspeed/2008-10-04/25
          4/windspeed/2008-10-01/35
          5/winddirection/2008-10-05/120
          5/winddirection/2008-11-01/360


          Note that the required sorting is lexical rather than numeric - if the first column values in FILE1 exceed 9, then you will likely need to pre-sort that as well.






          share|improve this answer
























          • Many thanks my friend. finally worked. Steeldriver you deserve a medal

            – Gonzalo Ponce
            4 mins ago














          0












          0








          0







          join expects its inputs to be sorted (on the fields that are to be joined). In this case (making use of the bash shell's process substitution):



          $ join -t/ -1 1 -2 2 FILE1 <(sort -t/ -k2 FILE2)
          1/temperature/2008-10-10/32
          1/temperature/2008-10-01/45
          1/temperature/2008-12-01/61
          1/temperature/2008-10-01/68
          1/temperature/2008-10-01/89
          2/rainfall/2008-10-02/6
          3/snowfall/2008-10-03/4
          4/windspeed/2008-10-04/25
          4/windspeed/2008-10-01/35
          5/winddirection/2008-10-05/120
          5/winddirection/2008-11-01/360


          Note that the required sorting is lexical rather than numeric - if the first column values in FILE1 exceed 9, then you will likely need to pre-sort that as well.






          share|improve this answer













          join expects its inputs to be sorted (on the fields that are to be joined). In this case (making use of the bash shell's process substitution):



          $ join -t/ -1 1 -2 2 FILE1 <(sort -t/ -k2 FILE2)
          1/temperature/2008-10-10/32
          1/temperature/2008-10-01/45
          1/temperature/2008-12-01/61
          1/temperature/2008-10-01/68
          1/temperature/2008-10-01/89
          2/rainfall/2008-10-02/6
          3/snowfall/2008-10-03/4
          4/windspeed/2008-10-04/25
          4/windspeed/2008-10-01/35
          5/winddirection/2008-10-05/120
          5/winddirection/2008-11-01/360


          Note that the required sorting is lexical rather than numeric - if the first column values in FILE1 exceed 9, then you will likely need to pre-sort that as well.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 12 mins ago









          steeldriversteeldriver

          40.1k4 gold badges54 silver badges93 bronze badges




          40.1k4 gold badges54 silver badges93 bronze badges













          • Many thanks my friend. finally worked. Steeldriver you deserve a medal

            – Gonzalo Ponce
            4 mins ago



















          • Many thanks my friend. finally worked. Steeldriver you deserve a medal

            – Gonzalo Ponce
            4 mins ago

















          Many thanks my friend. finally worked. Steeldriver you deserve a medal

          – Gonzalo Ponce
          4 mins ago





          Many thanks my friend. finally worked. Steeldriver you deserve a medal

          – Gonzalo Ponce
          4 mins ago










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










          draft saved

          draft discarded


















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













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












          Gonzalo Ponce 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%2f526542%2fjoin-commands-not-working-as-expected%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...