I have two .csv files namely file1.csv and file2.csv
file1.csv
ADIS
BAP3
Mercury_System
nxh-2003
DR_FeatureUP_PT
file2.csv
ADIS,projects.adis
EcoSystems,projects.ecosystems
em1xxxsw,projects.em1xxxsw
BAP3,projects.bap3
Dirana4,projects.dirana4
Mercury_System,projects.mercury_system
nxh-2003,projects.nxh-2003
DocStore,projects.docstore
DR_FeatureUP_PT,projects.dr_featureup_pt
Desired output.csv
ADIS,projects.adis
BAP3,projects.bap3
Mercury_System,projects.mercury_system
nxh-2003,projects.nxh-2003
DR_FeatureUP_PT,projects.dr_featureup_pt
I have already tried couple of codes below, but none of them worked for me as per the requirement
grep -Ff file1.csv file2.csv > outfile.csv
awk -F, 'NR==FNR{seen[$0]++;next} ($1 in seen)' file1.csv file2.csv > outfile.csv
file1.csv contains 2500 rows and file2.csv contains 118 rows, so it should compare and give me only results which are matching to file2, output should be matching to 118 rows/results.