Bash data parsing question....
I have two csv files. I need to combine them in a certain way. I can't use the 'join' command, as the specific fields I want to match are not perfectly sorted.
Here is an example of the two files:
file1.csv
recipe01,chicken
recipe02,beef
recipe03,chicken
recipe04,fish
file2.csv
chicken,clucks
beef,moos
fish,warblegarble
I need to find a way to create the following file:
file3.csv
recipe01,chicken,clucks
recipe02,beef,moos
recipe03,chicken,clucks
recipe04,fish,warblegarble
Anyone know a good command, program, or script that would do that? Go through field 2 of the first file and match it to field 1 of the second file, and add field 2 of the second file to the line?