Bash : joint 2 fichiers ?

Résolu/Fermé
mortel - Modifié par mortel le 26/02/2015 à 23:52
 mortel - 4 mars 2015 à 10:46
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

dubcek Messages postés 18718 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 22 mars 2024 5 615
27 févr. 2015 à 15:25
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
zipe31 Messages postés 36402 Date d'inscription dimanche 7 novembre 2010 Statut Contributeur Dernière intervention 27 janvier 2021 6 407
27 févr. 2015 à 10:56
Salut,

Voir la commande
join
;-)
0
merci
0