I have a requirement to match column 4 (Grade) from File1 with column 1 (Grade) of File2. If it matches, replace column 4 (Grade) of File1 with column2 (Marks) of File2. If it doesn't match, then leave the value of column 4 (Grade) as is.
File1
"RollNo","Name","Age","Grade","Class","Teacher"
"1","Asha","7","A","1","David"
"2","Mona","7","B","1","David"
"3","Sonali","7","C","1","David"
"4","Rani","7","D","1","David"
"5","Raj","7","B","1","David"
File2
"Grade","Marks"
"A","90"
"B","80"
"C","70"
Expected output:
"RollNo","Name","Age","Grade","Class","Teacher"
"1","Asha","7","90","1","David"
"2","Mona","7","80","1","David"
"3","Sonali","7","70","1","David"
"4","Rani","7","D","1","David"
"5","Raj","7","80","1","David"
Can you please help me with an awk command for this output?
Looking ahead for your response.
,
,"
, or newline (\n
)? Do your records end with\n
(common in Unix) or\r\n
(common in files created on Windows, e.g. a CSV exported from MS-Excel)? Please tag your question with the OS and shell you use.