Join two files based on shared key

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
-1
down vote

favorite












I have two files I would like to join based on the bakery store number.



[File 1] bakedGoods.txt



1:Chocolate Cookies:111
2:Banana Muffins:222
3:Apple Pie:333
4:Strawberry Cheesecake:444
5:Pineapple Turnover:555


Where column 1 is the number of the item, column 2 is the item name, and column 3 is the store number.



[File 2] bakeryStores.txt



111:Cookies Cookies Cookies
222:Bellas Desserts Co.
333:Apples N' Sweets
444:Cheesecake Emporium
777:Estrellas Bakery
888:Suzy's Baked Goods


Where column 1 is the bakery store number and column 2 is the name of the bakery.



My goal is to join the information that has the same bakery store number by using the join command (I assume that is the best way). This means column 3 for file 1 and column 1 for file 2. As well as display a message "Not in store" for the empty fields that are not pair-able. (Which I assume using the option -e"Not in store" is the best way to go. The below is what I am trying to achieve.



111:Chocolate Cookies:Cookies Cookies Cookies
222:Banana Muffins:Bellas Desserts Co.
333:Apple Pie:Apples N' Sweets
444:Strawberry Cheesecake:Cheesecake Emporium
Not in store
Not in store


I try to join the two files by store number, I am also using the -e option (for the message), but nothing changes. I see no output either.



I tried join -1 3 -2 1 -e "Not in store" bakedGoods.txt bakeryStores.txt I understand what I want to do and how to do it, just not sure why it is not displaying anything. Usually, when I join or combine files, without appending, I can see the result right away. I appended but the two files remain the same.










share|improve this question



















  • 1




    What part have you made of your homework so far and where exactly you need some clarification?
    – Rui F Ribeiro
    54 mins ago











  • Not homework, just for practice.. I guess it's my fault for using an example involving bakeries.. Anyways! I understand how joining works, but not sure what I am missing. Specifically, I type join -1 3 -2 1 -e "Not in store" bakedGoods.txt bakeryStores.txt -1 3 indicating the common field in file 1 (column 3) -2 1 inciditing the common field in file 2 (column 1)
    – Belle
    41 mins ago










  • Please show what you have tried. Without this, it is impossible to tell you what you did wrong.
    – ctrl-alt-delor
    5 mins ago










  • @ctrl-alt-delor I tried join -1 3 -2 1 -e "Not in store" bakedGoods.txt bakeryStores.txt I understand what I want to do and how to do it, just not sure why it is not displaying anything. Usually, when I join or combine files, without appending, I can see the result right away. I then appended to check for any changes but the two files remain the same.
    – Belle
    2 mins ago















up vote
-1
down vote

favorite












I have two files I would like to join based on the bakery store number.



[File 1] bakedGoods.txt



1:Chocolate Cookies:111
2:Banana Muffins:222
3:Apple Pie:333
4:Strawberry Cheesecake:444
5:Pineapple Turnover:555


Where column 1 is the number of the item, column 2 is the item name, and column 3 is the store number.



[File 2] bakeryStores.txt



111:Cookies Cookies Cookies
222:Bellas Desserts Co.
333:Apples N' Sweets
444:Cheesecake Emporium
777:Estrellas Bakery
888:Suzy's Baked Goods


Where column 1 is the bakery store number and column 2 is the name of the bakery.



My goal is to join the information that has the same bakery store number by using the join command (I assume that is the best way). This means column 3 for file 1 and column 1 for file 2. As well as display a message "Not in store" for the empty fields that are not pair-able. (Which I assume using the option -e"Not in store" is the best way to go. The below is what I am trying to achieve.



111:Chocolate Cookies:Cookies Cookies Cookies
222:Banana Muffins:Bellas Desserts Co.
333:Apple Pie:Apples N' Sweets
444:Strawberry Cheesecake:Cheesecake Emporium
Not in store
Not in store


I try to join the two files by store number, I am also using the -e option (for the message), but nothing changes. I see no output either.



I tried join -1 3 -2 1 -e "Not in store" bakedGoods.txt bakeryStores.txt I understand what I want to do and how to do it, just not sure why it is not displaying anything. Usually, when I join or combine files, without appending, I can see the result right away. I appended but the two files remain the same.










share|improve this question



















  • 1




    What part have you made of your homework so far and where exactly you need some clarification?
    – Rui F Ribeiro
    54 mins ago











  • Not homework, just for practice.. I guess it's my fault for using an example involving bakeries.. Anyways! I understand how joining works, but not sure what I am missing. Specifically, I type join -1 3 -2 1 -e "Not in store" bakedGoods.txt bakeryStores.txt -1 3 indicating the common field in file 1 (column 3) -2 1 inciditing the common field in file 2 (column 1)
    – Belle
    41 mins ago










  • Please show what you have tried. Without this, it is impossible to tell you what you did wrong.
    – ctrl-alt-delor
    5 mins ago










  • @ctrl-alt-delor I tried join -1 3 -2 1 -e "Not in store" bakedGoods.txt bakeryStores.txt I understand what I want to do and how to do it, just not sure why it is not displaying anything. Usually, when I join or combine files, without appending, I can see the result right away. I then appended to check for any changes but the two files remain the same.
    – Belle
    2 mins ago













up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I have two files I would like to join based on the bakery store number.



[File 1] bakedGoods.txt



1:Chocolate Cookies:111
2:Banana Muffins:222
3:Apple Pie:333
4:Strawberry Cheesecake:444
5:Pineapple Turnover:555


Where column 1 is the number of the item, column 2 is the item name, and column 3 is the store number.



[File 2] bakeryStores.txt



111:Cookies Cookies Cookies
222:Bellas Desserts Co.
333:Apples N' Sweets
444:Cheesecake Emporium
777:Estrellas Bakery
888:Suzy's Baked Goods


Where column 1 is the bakery store number and column 2 is the name of the bakery.



My goal is to join the information that has the same bakery store number by using the join command (I assume that is the best way). This means column 3 for file 1 and column 1 for file 2. As well as display a message "Not in store" for the empty fields that are not pair-able. (Which I assume using the option -e"Not in store" is the best way to go. The below is what I am trying to achieve.



111:Chocolate Cookies:Cookies Cookies Cookies
222:Banana Muffins:Bellas Desserts Co.
333:Apple Pie:Apples N' Sweets
444:Strawberry Cheesecake:Cheesecake Emporium
Not in store
Not in store


I try to join the two files by store number, I am also using the -e option (for the message), but nothing changes. I see no output either.



I tried join -1 3 -2 1 -e "Not in store" bakedGoods.txt bakeryStores.txt I understand what I want to do and how to do it, just not sure why it is not displaying anything. Usually, when I join or combine files, without appending, I can see the result right away. I appended but the two files remain the same.










share|improve this question















I have two files I would like to join based on the bakery store number.



[File 1] bakedGoods.txt



1:Chocolate Cookies:111
2:Banana Muffins:222
3:Apple Pie:333
4:Strawberry Cheesecake:444
5:Pineapple Turnover:555


Where column 1 is the number of the item, column 2 is the item name, and column 3 is the store number.



[File 2] bakeryStores.txt



111:Cookies Cookies Cookies
222:Bellas Desserts Co.
333:Apples N' Sweets
444:Cheesecake Emporium
777:Estrellas Bakery
888:Suzy's Baked Goods


Where column 1 is the bakery store number and column 2 is the name of the bakery.



My goal is to join the information that has the same bakery store number by using the join command (I assume that is the best way). This means column 3 for file 1 and column 1 for file 2. As well as display a message "Not in store" for the empty fields that are not pair-able. (Which I assume using the option -e"Not in store" is the best way to go. The below is what I am trying to achieve.



111:Chocolate Cookies:Cookies Cookies Cookies
222:Banana Muffins:Bellas Desserts Co.
333:Apple Pie:Apples N' Sweets
444:Strawberry Cheesecake:Cheesecake Emporium
Not in store
Not in store


I try to join the two files by store number, I am also using the -e option (for the message), but nothing changes. I see no output either.



I tried join -1 3 -2 1 -e "Not in store" bakedGoods.txt bakeryStores.txt I understand what I want to do and how to do it, just not sure why it is not displaying anything. Usually, when I join or combine files, without appending, I can see the result right away. I appended but the two files remain the same.







linux text-processing join






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 40 secs ago









ctrl-alt-delor

9,31731948




9,31731948










asked 1 hour ago









Belle

12




12







  • 1




    What part have you made of your homework so far and where exactly you need some clarification?
    – Rui F Ribeiro
    54 mins ago











  • Not homework, just for practice.. I guess it's my fault for using an example involving bakeries.. Anyways! I understand how joining works, but not sure what I am missing. Specifically, I type join -1 3 -2 1 -e "Not in store" bakedGoods.txt bakeryStores.txt -1 3 indicating the common field in file 1 (column 3) -2 1 inciditing the common field in file 2 (column 1)
    – Belle
    41 mins ago










  • Please show what you have tried. Without this, it is impossible to tell you what you did wrong.
    – ctrl-alt-delor
    5 mins ago










  • @ctrl-alt-delor I tried join -1 3 -2 1 -e "Not in store" bakedGoods.txt bakeryStores.txt I understand what I want to do and how to do it, just not sure why it is not displaying anything. Usually, when I join or combine files, without appending, I can see the result right away. I then appended to check for any changes but the two files remain the same.
    – Belle
    2 mins ago













  • 1




    What part have you made of your homework so far and where exactly you need some clarification?
    – Rui F Ribeiro
    54 mins ago











  • Not homework, just for practice.. I guess it's my fault for using an example involving bakeries.. Anyways! I understand how joining works, but not sure what I am missing. Specifically, I type join -1 3 -2 1 -e "Not in store" bakedGoods.txt bakeryStores.txt -1 3 indicating the common field in file 1 (column 3) -2 1 inciditing the common field in file 2 (column 1)
    – Belle
    41 mins ago










  • Please show what you have tried. Without this, it is impossible to tell you what you did wrong.
    – ctrl-alt-delor
    5 mins ago










  • @ctrl-alt-delor I tried join -1 3 -2 1 -e "Not in store" bakedGoods.txt bakeryStores.txt I understand what I want to do and how to do it, just not sure why it is not displaying anything. Usually, when I join or combine files, without appending, I can see the result right away. I then appended to check for any changes but the two files remain the same.
    – Belle
    2 mins ago








1




1




What part have you made of your homework so far and where exactly you need some clarification?
– Rui F Ribeiro
54 mins ago





What part have you made of your homework so far and where exactly you need some clarification?
– Rui F Ribeiro
54 mins ago













Not homework, just for practice.. I guess it's my fault for using an example involving bakeries.. Anyways! I understand how joining works, but not sure what I am missing. Specifically, I type join -1 3 -2 1 -e "Not in store" bakedGoods.txt bakeryStores.txt -1 3 indicating the common field in file 1 (column 3) -2 1 inciditing the common field in file 2 (column 1)
– Belle
41 mins ago




Not homework, just for practice.. I guess it's my fault for using an example involving bakeries.. Anyways! I understand how joining works, but not sure what I am missing. Specifically, I type join -1 3 -2 1 -e "Not in store" bakedGoods.txt bakeryStores.txt -1 3 indicating the common field in file 1 (column 3) -2 1 inciditing the common field in file 2 (column 1)
– Belle
41 mins ago












Please show what you have tried. Without this, it is impossible to tell you what you did wrong.
– ctrl-alt-delor
5 mins ago




Please show what you have tried. Without this, it is impossible to tell you what you did wrong.
– ctrl-alt-delor
5 mins ago












@ctrl-alt-delor I tried join -1 3 -2 1 -e "Not in store" bakedGoods.txt bakeryStores.txt I understand what I want to do and how to do it, just not sure why it is not displaying anything. Usually, when I join or combine files, without appending, I can see the result right away. I then appended to check for any changes but the two files remain the same.
– Belle
2 mins ago





@ctrl-alt-delor I tried join -1 3 -2 1 -e "Not in store" bakedGoods.txt bakeryStores.txt I understand what I want to do and how to do it, just not sure why it is not displaying anything. Usually, when I join or combine files, without appending, I can see the result right away. I then appended to check for any changes but the two files remain the same.
– Belle
2 mins ago
















active

oldest

votes











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',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f477133%2fjoin-two-files-based-on-shared-key%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f477133%2fjoin-two-files-based-on-shared-key%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay