指定された行に基づいて2つのファイルをマージします。

指定された行に基づいて2つのファイルをマージします。

私は持っていますファイル1.txt次のようになります。

search
http://google.com
mail
https://gmail.com

ファイル2.txt次のようになります。

This is a search tool
This is your mail account

このようにマージする必要がありますファイル1.txt次のようになります。

This is a search tool
http://google.com
This is your mail account
https://gmail.com

ベストアンサー1

また試み

awk '
NR == FNR   {T[$0]
             next
            }
            {for (t in T) if (t ~ $1) $1 = t
            }
1
' file2 file1
This is a search tool
http://google.com
This is your mail account
https://gmail.com

おすすめ記事