次のような 2 列のデータを含むファイル (file1) の場合:
1232323 dog
21321 cat
21321 fox
2312323 bird
2 列のデータを含む 2 番目のファイル (file2) は、次のようになります。
dog red
cat blue
fox green
bird black
file1 の列 2 のすべてのエントリを繰り返し処理して、file2 の列 1 から一致するエントリを見つけ、file2 の列 2 のデータを検索に追加する 3 番目のファイルを作成するスクリプトを作成しようとしています。次のようにヒットします。
1232323 dog red
21321 cat blue
21321 fox green
2312323 bird black
ここにいくつかの擬似コードがあります:
For each string in field 2 of file1
grep file2
output field1 and field2 of file1 and matching field2 of file2 from any hits to file3
ありがとうございました。