Update rows by referring another fileMatch ids and print original fileRead a column from a file and append a...

Why can't I share a one use code with anyone else?

History of the Frobenius Endomorphism?

Why did the metro bus stop at each railway crossing, despite no warning indicating a train was coming?

Formal Definition of Dot Product

What is the effect of the Feeblemind spell on Ability Score Improvements?

How would you translate "grit" (personality trait) to Chinese?

Single word that parallels "Recent" when discussing the near future

Developers demotivated due to working on same project for more than 2 years

What information exactly does an instruction cache store?

Why is the marginal distribution/marginal probability described as "marginal"?

Can anyone give me examples of the relative-determinative 'which'?

What was Varys trying to do at the beginning of S08E05?

Why would someone open a Netflix account using my Gmail address?

How does Ctrl+c and Ctrl+v work?

How does a permutation act on a string?

Polynomial division: Is this trick obvious?

I recently started my machine learning PhD and I have absolutely no idea what I'm doing

Why commonly or frequently used fonts sizes are even numbers like 10px, 12px, 16px, 24px, or 32px?

What metal is most suitable for a ladder submerged in an underground water tank?

Why when I add jam to my tea it stops producing thin "membrane" on top?

Why would company (decision makers) wait for someone to retire, rather than lay them off, when their role is no longer needed?

Windows 10 lock screen - display my own random images

Does the wearer know what items are in which patch in the Robe of Useful items?

Were any toxic metals used in the International Space Station?



Update rows by referring another file


Match ids and print original fileRead a column from a file and append a specific column of another fileAppend mth and nth columns of a file with the columns of another fileCheck if a field of a file exists in another file and update the the first file's specific columnGet string from filename to output file plus string inside same fileExact difference between data of rows in two files in LinuxIs there a another way to display a part of a line using sedCompare two files by first column. Keep rows if matchingHow to split a file into paragraphs and name the resulting pieces based on an identifier present in each paragraphCompare two text files, extract matching rows of file2 plus additional rows






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







0















I have two comma separated files as mentioned below,



cat source.txt
A,1000
B,3000
C,2500
D,5000
E,4000
F,3000

cat test.txt
A,1000
C
D,5000
B
E


How can I update file test.txt by referring file source.txt, such that the expected output is as below,



cat test.txt
A,1000
C,2500
D,5000
B,3000
E,4000









share|improve this question























  • Do you just want to fill in missing values, or should all values get replaced by the one in source.txt?

    – finswimmer
    7 mins ago











  • I just want to replace missing values. Please refer expected output.

    – Swapnil Dhule
    1 min ago


















0















I have two comma separated files as mentioned below,



cat source.txt
A,1000
B,3000
C,2500
D,5000
E,4000
F,3000

cat test.txt
A,1000
C
D,5000
B
E


How can I update file test.txt by referring file source.txt, such that the expected output is as below,



cat test.txt
A,1000
C,2500
D,5000
B,3000
E,4000









share|improve this question























  • Do you just want to fill in missing values, or should all values get replaced by the one in source.txt?

    – finswimmer
    7 mins ago











  • I just want to replace missing values. Please refer expected output.

    – Swapnil Dhule
    1 min ago














0












0








0








I have two comma separated files as mentioned below,



cat source.txt
A,1000
B,3000
C,2500
D,5000
E,4000
F,3000

cat test.txt
A,1000
C
D,5000
B
E


How can I update file test.txt by referring file source.txt, such that the expected output is as below,



cat test.txt
A,1000
C,2500
D,5000
B,3000
E,4000









share|improve this question














I have two comma separated files as mentioned below,



cat source.txt
A,1000
B,3000
C,2500
D,5000
E,4000
F,3000

cat test.txt
A,1000
C
D,5000
B
E


How can I update file test.txt by referring file source.txt, such that the expected output is as below,



cat test.txt
A,1000
C,2500
D,5000
B,3000
E,4000






awk sed






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 10 mins ago









Swapnil DhuleSwapnil Dhule

925




925













  • Do you just want to fill in missing values, or should all values get replaced by the one in source.txt?

    – finswimmer
    7 mins ago











  • I just want to replace missing values. Please refer expected output.

    – Swapnil Dhule
    1 min ago



















  • Do you just want to fill in missing values, or should all values get replaced by the one in source.txt?

    – finswimmer
    7 mins ago











  • I just want to replace missing values. Please refer expected output.

    – Swapnil Dhule
    1 min ago

















Do you just want to fill in missing values, or should all values get replaced by the one in source.txt?

– finswimmer
7 mins ago





Do you just want to fill in missing values, or should all values get replaced by the one in source.txt?

– finswimmer
7 mins ago













I just want to replace missing values. Please refer expected output.

– Swapnil Dhule
1 min ago





I just want to replace missing values. Please refer expected output.

– Swapnil Dhule
1 min ago










0






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


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f518999%2fupdate-rows-by-referring-another-file%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































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%2f518999%2fupdate-rows-by-referring-another-file%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...