I am not sure what wrong I am doing but I am certainly making some mistake with my awk command.
I have two files, fileA contains names
FileA
Abhi
Roma
GiGi
KaKa
FileB contains other data with names
Abhi 23 Pk
DaDa 43 Gk
Roma 33 Kk
PkPk 22 Aa
Now, I trying to print the details of all the names that are absent in fileA.
for i in `cat FileA` ; do cat FileB | awk '{ if ($1!='$i') print $0_}'>> Result; done
What I get is
Abhi 23 Pk
DaDa 43 Gk
Roma 33 Kk
PkPk 22 Aa
Abhi 23 Pk
DaDa 43 Gk
Roma 33 Kk
PkPk 22 Aa
Abhi 23 Pk
DaDa 43 Gk
Desired output
DaDa 43 Gk
PkPk 22 Aa
Could anyone help me in finding out the error.
Thank you
Aucun commentaire:
Enregistrer un commentaire