Bash : joint 2 fichiers ?

Résolu
mortel -  
 mortel -
Bonjour,

J'ai un fichierA
man01 xxx yyy zzz
man02 xxx yyy zzz
man03 xxx yyy zzz
man04 xxx yyy zzz


Et un fichierB
man01 ggggg kkkkk
man02 yyyy
man02 tttttt jjjjjj
man04 lllllll rrrrrrrr eeeeeee


Comment joindre les 2 fichiers pour obtenir
man01 xxx yyy zzz ggggg kkkkk
man02 xxx yyy zzz yyyy
man02 xxx yyy zzz tttttt jjjjjj
man03 xxx yyy zzz
man04 xxx yyy zzz lllllll rrrrrrrr eeeeeee


Merci

3 réponses

  1. dubcek Messages postés 18627 Date d'inscription   Statut Contributeur Dernière intervention   5 660
     
    hello
    avec awk
    $ awk 'FNR==NR {t[$1]=$0; next}  {x=$1; $1=""; print t[x] $0}'  A B
    man01 xxx yyy zzz ggggg kkkkk
    man02 xxx yyy zzz yyyy
    man02 xxx yyy zzz tttttt jjjjjj
    man04 xxx yyy zzz lllllll rrrrrrrr eeeeeee
    1
  2. zipe31 Messages postés 34620 Date d'inscription   Statut Contributeur Dernière intervention   6 501
     
    Salut,

    Voir la commande
    join
    ;-)
    0